Skip to content

Commit a0b8109

Browse files
authored
Merge pull request #19562 from holiman/fix_tabcrash
p2p/discover: fix nil-dereference due to race
2 parents ec2131c + 9526391 commit a0b8109

3 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎p2p/discover/table.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ func newTable(t transport, db *enode.DB, bootnodes []*enode.Node, log log.Logger
119119
tab.seedRand()
120120
tab.loadSeedNodes()
121121

122-
go tab.loop()
123122
return tab, nil
124123
}
125124

‎p2p/discover/table_util_test.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func init() {
4242
func newTestTable(t transport) (*Table, *enode.DB) {
4343
db, _ := enode.OpenDB("")
4444
tab, _ := newTable(t, db, nil, log.Root())
45+
go tab.loop()
4546
return tab, db
4647
}
4748

‎p2p/discover/v4_udp.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ func ListenV4(c UDPConn, ln *enode.LocalNode, cfg Config) (*UDPv4, error) {
253253
return nil, err
254254
}
255255
t.tab = tab
256+
go tab.loop()
256257

257258
t.wg.Add(2)
258259
go t.loop()

0 commit comments

Comments
 (0)