contact retry force disconnect internally any connecting over 2xcircut timeout #521

Merged
sarah merged 1 commits from crForceDisconn into master 2023-07-25 21:22:39 +00:00
1 changed files with 10 additions and 0 deletions

View File

@ -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)
dan marked this conversation as resolved Outdated
Outdated
Review

this needs to log an Error. In normal operation this should not happen, and very likely indicates a failure to handle a missing connection issue somewhere else.

this needs to log an Error. In normal operation this should not happen, and very likely indicates a failure to handle a missing connection issue somewhere else.
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)
dan marked this conversation as resolved Outdated

for connecting for 2xcircutTimeout -> due to a circuit timeout perhaps? circut has a typo also.

`for connecting for 2xcircutTimeout` -> `due to a circuit timeout` perhaps? `circut` has a typo also.
}
return true
})
select {
case e := <-cr.queue.OutChan():