Skip to content

Commit

Permalink
p2p/server: add UDP port mapping goroutine to wait group (ethereum#20846
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ucwong authored Apr 1, 2020
1 parent 1e2e1b4 commit bf35e27
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,11 @@ func (srv *Server) setupDiscovery() error {
srv.log.Debug("UDP listener up", "addr", realaddr)
if srv.NAT != nil {
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)
Expand Down

0 comments on commit bf35e27

Please sign in to comment.