Unverified Commit bf35e27e authored by ucwong's avatar ucwong Committed by GitHub

p2p/server: add UDP port mapping goroutine to wait group (#20846)

parent 1e2e1b41
...@@ -562,7 +562,11 @@ func (srv *Server) setupDiscovery() error { ...@@ -562,7 +562,11 @@ func (srv *Server) setupDiscovery() error {
srv.log.Debug("UDP listener up", "addr", realaddr) srv.log.Debug("UDP listener up", "addr", realaddr)
if srv.NAT != nil { if srv.NAT != nil {
if !realaddr.IP.IsLoopback() { if !realaddr.IP.IsLoopback() {
go nat.Map(srv.NAT, srv.quit, "udp", realaddr.Port, realaddr.Port, "ethereum discovery") srv.loopWG.Add(1)
go func() {
nat.Map(srv.NAT, srv.quit, "udp", realaddr.Port, realaddr.Port, "ethereum discovery")
srv.loopWG.Done()
}()
} }
} }
srv.localnode.SetFallbackUDP(realaddr.Port) srv.localnode.SetFallbackUDP(realaddr.Port)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment