mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
p2p/discover | sync close tab when udp server is stopped
This commit is contained in:
parent
f0be151349
commit
bc0be4d6a7
1 changed files with 6 additions and 2 deletions
|
|
@ -280,7 +280,11 @@ func ListenV4(c UDPConn, ln *enode.LocalNode, cfg Config) (*UDPv4, error) {
|
|||
return nil, err
|
||||
}
|
||||
t.tab = tab
|
||||
go tab.loop()
|
||||
t.wg.Add(1)
|
||||
go func() {
|
||||
defer t.wg.Done()
|
||||
tab.loop()
|
||||
}()
|
||||
|
||||
t.wg.Add(2)
|
||||
go t.loop()
|
||||
|
|
@ -298,8 +302,8 @@ func (t *UDPv4) Close() {
|
|||
t.closeOnce.Do(func() {
|
||||
t.cancelCloseCtx()
|
||||
t.conn.Close()
|
||||
t.wg.Wait()
|
||||
t.tab.close()
|
||||
t.wg.Wait()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue