From 1f2617e4ae782de427a823b2c51c2f87da2816bc Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 19 Jul 2023 21:57:13 -0700 Subject: [PATCH] contact retry force disconnect internally any connecting over 2xcircut timeout --- app/plugins/contactRetry.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/plugins/contactRetry.go b/app/plugins/contactRetry.go index d7fa5b0..b3cef2c 100644 --- a/app/plugins/contactRetry.go +++ b/app/plugins/contactRetry.go @@ -212,6 +212,16 @@ func (cr *contactRetry) run() { } cr.lastCheck = time.Now() } + // regardless of if we're up, run manual force deconnectiong of timed out connections + cr.connections.Range(func(k, v interface{}) bool { + p := v.(*contact) + if p.state == connections.CONNECTING && time.Since(p.lastAttempt) > time.Duration(circuitTimeoutSecs)*time.Second*2 { + // we have been "connecting" for twice the circuttimeout so it's failed, we just didn't learn about it, manually disconnect + cr.handleEvent(p.id, connections.DISCONNECTED, p.ctype) + log.Errorf("had to manually set peer %v of profile %v to DISCONNECTED due to assumed circuit timeout (%v) seconds", p.id, cr.onion, circuitTimeoutSecs*2) + } + return true + }) select { case e := <-cr.queue.OutChan():