forked from TrueCloudLab/neoneo-go
network: register peer only if it's not a duplicate
This commit is contained in:
parent
851cbc7dab
commit
65f0fadddb
1 changed files with 1 additions and 1 deletions
|
@ -670,7 +670,6 @@ func (s *Server) handleVersionCmd(p Peer, version *payload.Version) error {
|
||||||
return errInvalidNetwork
|
return errInvalidNetwork
|
||||||
}
|
}
|
||||||
peerAddr := p.PeerAddr().String()
|
peerAddr := p.PeerAddr().String()
|
||||||
s.discovery.RegisterConnectedAddr(peerAddr)
|
|
||||||
s.lock.RLock()
|
s.lock.RLock()
|
||||||
for peer := range s.peers {
|
for peer := range s.peers {
|
||||||
if p == peer {
|
if p == peer {
|
||||||
|
@ -684,6 +683,7 @@ func (s *Server) handleVersionCmd(p Peer, version *payload.Version) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.lock.RUnlock()
|
s.lock.RUnlock()
|
||||||
|
s.discovery.RegisterConnectedAddr(peerAddr)
|
||||||
return p.SendVersionAck(NewMessage(CMDVerack, payload.NewNullPayload()))
|
return p.SendVersionAck(NewMessage(CMDVerack, payload.NewNullPayload()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue