server: fix regression in handling persistent connection requesrts

This commit fixes a bug that was introduced when the concurrent
connection handling logic was re-written: if we don’t properly add the
persistent outbound connection to the persistent conn reqs map. The fix
is easy: add the pending conn req to the proper map.
This commit is contained in:
Olaoluwa Osuntokun 2017-05-04 16:47:48 -07:00
parent 28e607b6ae
commit f335250512
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

View File

@ -1125,10 +1125,17 @@ func (s *server) handleConnectPeer(msg *connectPeerMsg) {
// persistent connection to the peer.
srvrLog.Debugf("Connecting to %v", addr)
if msg.persistent {
go s.connMgr.Connect(&connmgr.ConnReq{
connReq := &connmgr.ConnReq{
Addr: addr,
Permanent: true,
})
}
s.pendingConnMtx.Lock()
s.persistentConnReqs[targetPub] = append(s.persistentConnReqs[targetPub],
connReq)
s.pendingConnMtx.Unlock()
go s.connMgr.Connect(connReq)
msg.err <- nil
} else {
// If we're not making a persistent connection, then we'll