mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-09-26 20:21:26 +08:00
nat: improve port mapping failure logging (#3261)
This commit is contained in:
@@ -239,11 +239,10 @@ func (nat *NAT) establishMapping(ctx context.Context, protocol string, internalP
|
||||
nat.natmu.Unlock()
|
||||
|
||||
if err != nil || externalPort == 0 {
|
||||
// TODO: log.Event
|
||||
if err != nil {
|
||||
log.Warnf("failed to establish port mapping: %s", err)
|
||||
log.Warnf("NAT port mapping failed: protocol=%s internal_port=%d error=%q", protocol, internalPort, err)
|
||||
} else {
|
||||
log.Warnf("failed to establish port mapping: newport = 0")
|
||||
log.Warnf("NAT port mapping failed: protocol=%s internal_port=%d external_port=0", protocol, internalPort)
|
||||
}
|
||||
// we do not close if the mapping failed,
|
||||
// because it may work again next time.
|
||||
|
Reference in New Issue
Block a user