aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
Diffstat (limited to 'p2p')
-rw-r--r--p2p/server.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/p2p/server.go b/p2p/server.go
index b93340150..e510be521 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -289,10 +289,13 @@ func (srv *Server) dialLoop() {
go srv.findPeers()
case dest := <-srv.peerConnect:
+ // avoid dialing nodes that are already connected.
+ // there is another check for this in addPeer,
+ // which runs after the handshake.
srv.lock.Lock()
_, isconnected := srv.peers[dest.ID]
srv.lock.Unlock()
- if isconnected || dialing[dest.ID] {
+ if isconnected || dialing[dest.ID] || dest.ID == srv.ntab.Self() {
continue
}