lndc+lnd: fix panic when connecting to multiple peers, plus duplicate conn detection

This commit is contained in:
Olaoluwa Osuntokun committed 2016-07-16 18:01:05 -07:00
1 parent 9780f06faf
commit 2a57f9182a
4 files changed
+50 -18

No files matched your search

+2 -2
View File
@@ -283,13 +283,13 @@ func (s *server) handleConnectPeer(msg *connectPeerMsg) {
// Ensure we're not already connected to this
// peer.
for _, peer := range s.peers {
if peer.lightningAddr.String() ==
addr.String() {
if peer.lightningAddr.String() == addr.String() {
msg.err <- fmt.Errorf(
"already connected to peer: %v",
peer.lightningAddr,
)
msg.resp <- -1
return
}
}