Merge pull request #19562 from holiman/fix_tabcrash
p2p/discover: fix nil-dereference due to race
This commit is contained in:
commit
a0b81097ad
@ -119,7 +119,6 @@ func newTable(t transport, db *enode.DB, bootnodes []*enode.Node, log log.Logger
|
|||||||
tab.seedRand()
|
tab.seedRand()
|
||||||
tab.loadSeedNodes()
|
tab.loadSeedNodes()
|
||||||
|
|
||||||
go tab.loop()
|
|
||||||
return tab, nil
|
return tab, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ func init() {
|
|||||||
func newTestTable(t transport) (*Table, *enode.DB) {
|
func newTestTable(t transport) (*Table, *enode.DB) {
|
||||||
db, _ := enode.OpenDB("")
|
db, _ := enode.OpenDB("")
|
||||||
tab, _ := newTable(t, db, nil, log.Root())
|
tab, _ := newTable(t, db, nil, log.Root())
|
||||||
|
go tab.loop()
|
||||||
return tab, db
|
return tab, db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +253,7 @@ func ListenV4(c UDPConn, ln *enode.LocalNode, cfg Config) (*UDPv4, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
t.tab = tab
|
t.tab = tab
|
||||||
|
go tab.loop()
|
||||||
|
|
||||||
t.wg.Add(2)
|
t.wg.Add(2)
|
||||||
go t.loop()
|
go t.loop()
|
||||||
|
Loading…
Reference in New Issue
Block a user