Skip to content

Commit

Permalink
p2p/nat: less confusing error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed May 6, 2015
1 parent 24d44f3 commit fd4b75c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions p2p/nat/nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ func Map(m Interface, c chan struct{}, protocol string, extport, intport int, na
}()
glog.V(logger.Debug).Infof("add mapping: %s %d -> %d (%s) using %s\n", protocol, extport, intport, name, m)
if err := m.AddMapping(protocol, intport, extport, name, mapTimeout); err != nil {
glog.V(logger.Error).Infof("mapping error: %v\n", err)
glog.V(logger.Warn).Infof("network port %d could not be mapped: %v\n", intport, err)
glog.V(logger.Debug).Infof("mapping with %v returned %v\n", m, err)
}
for {
select {
Expand All @@ -102,7 +103,8 @@ func Map(m Interface, c chan struct{}, protocol string, extport, intport int, na
case <-refresh.C:
glog.V(logger.Detail).Infof("refresh mapping: %s %d -> %d (%s) using %s\n", protocol, extport, intport, name, m)
if err := m.AddMapping(protocol, intport, extport, name, mapTimeout); err != nil {
glog.V(logger.Error).Infof("mapping error: %v\n", err)
glog.V(logger.Warn).Infof("network port %d could not be mapped: %v\n", intport, err)
glog.V(logger.Debug).Infof("mapping with %v returned %v\n", m, err)
}
refresh.Reset(mapUpdateInterval)
}
Expand Down Expand Up @@ -225,7 +227,7 @@ func (n *autodisc) wait() error {
return nil
}
if found = <-n.done; found == nil {
return errors.New("no devices discovered")
return errors.New("no UPnP or NAT-PMP router discovered")
}
n.mu.Lock()
n.found = found
Expand Down

0 comments on commit fd4b75c

Please sign in to comment.