server: mark address as connected within handleAddPeerMsg
We do this to ensure the address manager contains live addresses. Previously, addresses with which we established connections with would not be marked as connected because it would be done once we disconnect peers. Given that we don't process all of the disconnect logic when we're shutting down, addresses of stable and good peers would never be marked as connected unless the connection was lost during operation.
This commit is contained in:
parent
06baabe5da
commit
ab6f3089f6
1 changed files with 6 additions and 6 deletions
12
server.go
12
server.go
|
@ -1651,6 +1651,12 @@ func (s *server) handleAddPeerMsg(state *peerState, sp *serverPeer) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the address' last seen time if the peer has acknowledged
|
||||||
|
// our version and has sent us its version as well.
|
||||||
|
if sp.VerAckReceived() && sp.VersionKnown() && sp.NA() != nil {
|
||||||
|
s.addrManager.Connected(sp.NA())
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1681,12 +1687,6 @@ func (s *server) handleDonePeerMsg(state *peerState, sp *serverPeer) {
|
||||||
s.connManager.Disconnect(sp.connReq.ID())
|
s.connManager.Disconnect(sp.connReq.ID())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the address' last seen time if the peer has acknowledged
|
|
||||||
// our version and has sent us its version as well.
|
|
||||||
if sp.VerAckReceived() && sp.VersionKnown() && sp.NA() != nil {
|
|
||||||
s.addrManager.Connected(sp.NA())
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we get here it means that either we didn't know about the peer
|
// If we get here it means that either we didn't know about the peer
|
||||||
// or we purposefully deleted it.
|
// or we purposefully deleted it.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue