aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/nat/nat.go
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/nat/nat.go')
-rw-r--r--p2p/nat/nat.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/p2p/nat/nat.go b/p2p/nat/nat.go
index 505a1fc77..f9ba93613 100644
--- a/p2p/nat/nat.go
+++ b/p2p/nat/nat.go
@@ -105,7 +105,7 @@ func Map(m Interface, c chan struct{}, protocol string, extport, intport int, na
glog.V(logger.Debug).Infof("deleting port mapping: %s %d -> %d (%s) using %s\n", protocol, extport, intport, name, m)
m.DeleteMapping(protocol, extport, intport)
}()
- if err := m.AddMapping(protocol, intport, extport, name, mapTimeout); err != nil {
+ if err := m.AddMapping(protocol, extport, intport, name, mapTimeout); err != nil {
glog.V(logger.Debug).Infof("network port %s:%d could not be mapped: %v\n", protocol, intport, err)
} else {
glog.V(logger.Info).Infof("mapped network port %s:%d -> %d (%s) using %s\n", protocol, extport, intport, name, m)
@@ -118,7 +118,7 @@ func Map(m Interface, c chan struct{}, protocol string, extport, intport int, na
}
case <-refresh.C:
glog.V(logger.Detail).Infof("refresh port mapping %s:%d -> %d (%s) using %s\n", protocol, extport, intport, name, m)
- if err := m.AddMapping(protocol, intport, extport, name, mapTimeout); err != nil {
+ if err := m.AddMapping(protocol, extport, intport, name, mapTimeout); err != nil {
glog.V(logger.Debug).Infof("network port %s:%d could not be mapped: %v\n", protocol, intport, err)
}
refresh.Reset(mapUpdateInterval)
@@ -197,11 +197,7 @@ type autodisc struct {
func startautodisc(what string, doit func() Interface) Interface {
// TODO: monitor network configuration and rerun doit when it changes.
- ad := &autodisc{what: what, doit: doit}
- // Start the auto discovery as early as possible so it is already
- // in progress when the rest of the stack calls the methods.
- go ad.wait()
- return ad
+ return &autodisc{what: what, doit: doit}
}
func (n *autodisc) AddMapping(protocol string, extport, intport int, name string, lifetime time.Duration) error {