Skip to content

Commit 24ee5c1

Browse files
gzliudanucwong
andauthored
feat(p2p/server): add UDP port mapping goroutine to wait group ethereum#20846 (#2408)
Co-authored-by: ucwong <ucwong@126.com>
1 parent a2e27f0 commit 24ee5c1

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

p2p/server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,9 @@ func (srv *Server) setupDiscovery() error {
545545
srv.log.Debug("UDP listener up", "addr", realaddr)
546546
if srv.NAT != nil {
547547
if !realaddr.IP.IsLoopback() {
548-
go nat.Map(srv.NAT, srv.quit, "udp", realaddr.Port, realaddr.Port, "ethereum discovery")
548+
srv.loopWG.Go(func() {
549+
nat.Map(srv.NAT, srv.quit, "udp", realaddr.Port, realaddr.Port, "ethereum discovery")
550+
})
549551
}
550552
}
551553
srv.localnode.SetFallbackUDP(realaddr.Port)

0 commit comments

Comments
 (0)