mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-04 19:19:44 +00:00
network: don't register addresses before version handshake
1) It duplicates registration in `version` message handler and no valid connection can work without version exchange. 2) On public networks we have seed nodes defined by names, so we register connections to them using these names, but then if connection is dropped we delist them by IP:PORT combinations which can lead to zero PeerCount() with all seeds still being registered as connected in the discovery subsystem and thus no reconnection attempts being made.
This commit is contained in:
parent
33db3f76c0
commit
46a59e904a
2 changed files with 1 additions and 2 deletions
|
@ -177,8 +177,6 @@ func (d *DefaultDiscovery) tryAddress(addr string) {
|
||||||
if err := d.transport.Dial(addr, d.dialTimeout); err != nil {
|
if err := d.transport.Dial(addr, d.dialTimeout); err != nil {
|
||||||
d.RegisterBadAddr(addr)
|
d.RegisterBadAddr(addr)
|
||||||
d.RequestRemote(1)
|
d.RequestRemote(1)
|
||||||
} else {
|
|
||||||
d.RegisterConnectedAddr(addr)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ func TestDefaultDiscoverer(t *testing.T) {
|
||||||
select {
|
select {
|
||||||
case a := <-ts.dialCh:
|
case a := <-ts.dialCh:
|
||||||
dialled = append(dialled, a)
|
dialled = append(dialled, a)
|
||||||
|
d.RegisterConnectedAddr(a)
|
||||||
case <-time.After(time.Second):
|
case <-time.After(time.Second):
|
||||||
t.Fatalf("timeout expecting for transport dial")
|
t.Fatalf("timeout expecting for transport dial")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue