Cleanup - maybe working...

This commit is contained in:
jdl
2026-06-09 20:17:21 +02:00
parent 96e7916721
commit b0ff07aad6
12 changed files with 66 additions and 35 deletions

View File

@@ -27,12 +27,12 @@ func (a *App) onTick() {
a.sendPing(p, now)
}
switch p.State() {
switch p.State {
case StateProbing:
// Promote probing peers to direct once alive (direct path confirmed
// working).
if time.Since(p.LastHandshakeTime()) < wginterface.SessionTimeout {
a.devAddDirect(p, p.WGEndpoint())
if time.Since(p.LastHandshakeTime()) < 2*wginterface.ProbeKeepalive {
a.devPromote(p)
}
case StateDirect:
@@ -43,8 +43,8 @@ func (a *App) onTick() {
}
}
// Ensure we have a live relay.
if a.relay == nil || !a.relay.Up() {
// Ensure we have a live relay (if we're not public).
if !a.isPublic && (a.relay == nil || !a.relay.Up()) {
a.switchActiveRelay()
}
}