diff options
author | Felix Lange <fjl@users.noreply.github.com> | 2018-02-12 20:36:09 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-02-12 20:36:09 +0800 |
commit | 9123eceb0f78f69e88d909a56ad7fadb75570198 (patch) | |
tree | f3f02d178a7b8452e29e8902490bc308ebae0bde /cmd | |
parent | 1d39912a9b9ec710460c82c403cc8f72ab7d30d9 (diff) | |
download | go-tangerine-9123eceb0f78f69e88d909a56ad7fadb75570198.tar go-tangerine-9123eceb0f78f69e88d909a56ad7fadb75570198.tar.gz go-tangerine-9123eceb0f78f69e88d909a56ad7fadb75570198.tar.bz2 go-tangerine-9123eceb0f78f69e88d909a56ad7fadb75570198.tar.lz go-tangerine-9123eceb0f78f69e88d909a56ad7fadb75570198.tar.xz go-tangerine-9123eceb0f78f69e88d909a56ad7fadb75570198.tar.zst go-tangerine-9123eceb0f78f69e88d909a56ad7fadb75570198.zip |
p2p, p2p/discover: misc connectivity improvements (#16069)
* p2p: add DialRatio for configuration of inbound vs. dialed connections
* p2p: add connection flags to PeerInfo
* p2p/netutil: add SameNet, DistinctNetSet
* p2p/discover: improve revalidation and seeding
This changes node revalidation to be periodic instead of on-demand. This
should prevent issues where dead nodes get stuck in closer buckets
because no other node will ever come along to replace them.
Every 5 seconds (on average), the last node in a random bucket is
checked and moved to the front of the bucket if it is still responding.
If revalidation fails, the last node is replaced by an entry of the
'replacement list' containing recently-seen nodes.
Most close buckets are removed because it's very unlikely we'll ever
encounter a node that would fall into any of those buckets.
Table seeding is also improved: we now require a few minutes of table
membership before considering a node as a potential seed node. This
should make it less likely to store short-lived nodes as potential
seeds.
* p2p/discover: fix nits in UDP transport
We would skip sending neighbors replies if there were fewer than
maxNeighbors results and CheckRelayIP returned an error for the last
one. While here, also resolve a TODO about pong reply tokens.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/bootnode/main.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go index ecfc6fc24..2e93cc04d 100644 --- a/cmd/bootnode/main.go +++ b/cmd/bootnode/main.go @@ -122,7 +122,12 @@ func main() { utils.Fatalf("%v", err) } } else { - if _, err := discover.ListenUDP(nodeKey, conn, realaddr, nil, "", restrictList); err != nil { + cfg := discover.Config{ + PrivateKey: nodeKey, + AnnounceAddr: realaddr, + NetRestrict: restrictList, + } + if _, err := discover.ListenUDP(conn, cfg); err != nil { utils.Fatalf("%v", err) } } |