aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2019-05-13 17:25:54 +0800
committerMartin Holst Swende <martin@swende.se>2019-05-13 17:30:31 +0800
commit95263914fcc6631aedc7294624ae39c2adf3cb5f (patch)
treec8d04c7c2017b7c650b7179d21f50917db873410
parentabeba0a1de8e276255beba46b048627a4f529720 (diff)
downloadgo-tangerine-95263914fcc6631aedc7294624ae39c2adf3cb5f.tar
go-tangerine-95263914fcc6631aedc7294624ae39c2adf3cb5f.tar.gz
go-tangerine-95263914fcc6631aedc7294624ae39c2adf3cb5f.tar.bz2
go-tangerine-95263914fcc6631aedc7294624ae39c2adf3cb5f.tar.lz
go-tangerine-95263914fcc6631aedc7294624ae39c2adf3cb5f.tar.xz
go-tangerine-95263914fcc6631aedc7294624ae39c2adf3cb5f.tar.zst
go-tangerine-95263914fcc6631aedc7294624ae39c2adf3cb5f.zip
p2p/discover: fix a race where table loop would self-lookup before returning from constructor
-rw-r--r--p2p/discover/table.go1
-rw-r--r--p2p/discover/table_util_test.go1
-rw-r--r--p2p/discover/v4_udp.go1
3 files changed, 2 insertions, 1 deletions
diff --git a/p2p/discover/table.go b/p2p/discover/table.go
index 8afe77bf1..61c62f187 100644
--- a/p2p/discover/table.go
+++ b/p2p/discover/table.go
@@ -119,7 +119,6 @@ func newTable(t transport, db *enode.DB, bootnodes []*enode.Node, log log.Logger
tab.seedRand()
tab.loadSeedNodes()
- go tab.loop()
return tab, nil
}
diff --git a/p2p/discover/table_util_test.go b/p2p/discover/table_util_test.go
index 811466cf7..71cb1895b 100644
--- a/p2p/discover/table_util_test.go
+++ b/p2p/discover/table_util_test.go
@@ -42,6 +42,7 @@ func init() {
func newTestTable(t transport) (*Table, *enode.DB) {
db, _ := enode.OpenDB("")
tab, _ := newTable(t, db, nil, log.Root())
+ go tab.loop()
return tab, db
}
diff --git a/p2p/discover/v4_udp.go b/p2p/discover/v4_udp.go
index cdd42c38a..3c68beac1 100644
--- a/p2p/discover/v4_udp.go
+++ b/p2p/discover/v4_udp.go
@@ -253,6 +253,7 @@ func ListenV4(c UDPConn, ln *enode.LocalNode, cfg Config) (*UDPv4, error) {
return nil, err
}
t.tab = tab
+ go tab.loop()
t.wg.Add(2)
go t.loop()