server: exit early if not persistent peer

The point of this commit is to make future commits in the same PR easier
to review. All that this commit does is exit early if the peer we are
considering is not persistent instead of having a bunch of logic
indented in an if-clause.
This commit is contained in:
Elle Mouton
2021-09-27 16:27:17 +02:00
parent 18909e1a8e
commit 004ce640d0

View File

@@ -3517,8 +3517,10 @@ func (s *server) peerTerminationWatcher(p *peer.Brontide, ready chan struct{}) {
s.removePeer(p)
// Next, check to see if this is a persistent peer or not.
_, ok := s.persistentPeers[pubStr]
if ok {
if _, ok := s.persistentPeers[pubStr]; !ok {
return
}
// We'll only need to re-launch a connection request if one
// isn't already currently pending.
if _, ok := s.persistentConnReqs[pubStr]; ok {
@@ -3606,7 +3608,6 @@ func (s *server) peerTerminationWatcher(p *peer.Brontide, ready chan struct{}) {
s.connMgr.Connect(connReq)
}()
}
}
// removePeer removes the passed peer from the server's state of all active
// peers.