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 and enriquefynn committed Feb 15, 2021
1 parent c278617 commit 5085acd
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 5085acd

Please sign in to comment.