Skip to content

Commit fd4b75c

Browse files
committed
p2p/nat: less confusing error logging
1 parent 24d44f3 commit fd4b75c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

p2p/nat/nat.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ func Map(m Interface, c chan struct{}, protocol string, extport, intport int, na
9191
}()
9292
glog.V(logger.Debug).Infof("add mapping: %s %d -> %d (%s) using %s\n", protocol, extport, intport, name, m)
9393
if err := m.AddMapping(protocol, intport, extport, name, mapTimeout); err != nil {
94-
glog.V(logger.Error).Infof("mapping error: %v\n", err)
94+
glog.V(logger.Warn).Infof("network port %d could not be mapped: %v\n", intport, err)
95+
glog.V(logger.Debug).Infof("mapping with %v returned %v\n", m, err)
9596
}
9697
for {
9798
select {
@@ -102,7 +103,8 @@ func Map(m Interface, c chan struct{}, protocol string, extport, intport int, na
102103
case <-refresh.C:
103104
glog.V(logger.Detail).Infof("refresh mapping: %s %d -> %d (%s) using %s\n", protocol, extport, intport, name, m)
104105
if err := m.AddMapping(protocol, intport, extport, name, mapTimeout); err != nil {
105-
glog.V(logger.Error).Infof("mapping error: %v\n", err)
106+
glog.V(logger.Warn).Infof("network port %d could not be mapped: %v\n", intport, err)
107+
glog.V(logger.Debug).Infof("mapping with %v returned %v\n", m, err)
106108
}
107109
refresh.Reset(mapUpdateInterval)
108110
}
@@ -225,7 +227,7 @@ func (n *autodisc) wait() error {
225227
return nil
226228
}
227229
if found = <-n.done; found == nil {
228-
return errors.New("no devices discovered")
230+
return errors.New("no UPnP or NAT-PMP router discovered")
229231
}
230232
n.mu.Lock()
231233
n.found = found

0 commit comments

Comments
 (0)