From 06ec466c1b79d139d87eb32a78c00eeb90ed8d57 Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Wed, 8 Nov 2023 12:30:17 +0100 Subject: [PATCH] ping: better handling of restarts and stun errors --- pkg/arvo/app/ping.hoon | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/arvo/app/ping.hoon b/pkg/arvo/app/ping.hoon index beef0a5e26..00fb5d795e 100644 --- a/pkg/arvo/app/ping.hoon +++ b/pkg/arvo/app/ping.hoon @@ -275,7 +275,7 @@ :: (set-timer now) -- - :: Subsystem for formally acknowledge a change in our IP:PORT + :: Subsystem for formally acknowledging a change in our IP:PORT :: :: If our sponsor sends a STUN response, with an IP different than what :: we had previously cached, we formally acknowledge this change by @@ -370,9 +370,15 @@ :: repeatedly. :: =/ stun-failed=? &(?=([%off ~] plan.state) =(+.q.vase %.y)) - =? plan.state stun-failed + ?: &(?=([%off ~] plan.state) =(+.q.vase %.n)) + :: ignore restarts if we were already STUNning, if ip:port changed + :: %once will trigger one formal %ping + :: + `state + =? plan.state |(restart stun-failed) [%nat ~] - ?. &(stun-failed =(+.q.vase %.n)) `state + ?: &(!stun-failed =(+.q.vase %.y)) + `state (kick:ships our.bowl now.bowl) ?: =(q.vase %stop) :: NB: ames calls this on [%stun fail=%.n] =. plan.state [%off ~] @@ -415,7 +421,7 @@ [%one *] ?. ?=(%one -.plan.state) `state ?: ?=(%poke-ack -.sign) `state - ~& >>> '%once %ping failed' + :: XX handle error? `state == [cards this]