aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/nat/nat.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-05-14 18:54:59 +0800
committerFelix Lange <fjl@twurst.com>2015-05-14 18:54:59 +0800
commitc14de2e9733685e60f165ee5f2dd1f7c17f3f6cd (patch)
tree6342203691f83f7c949d4ad937468bee7d6aead2 /p2p/nat/nat.go
parente7c7b54b82e76f9da6caa44504486b28a662751d (diff)
downloadgo-tangerine-c14de2e9733685e60f165ee5f2dd1f7c17f3f6cd.tar
go-tangerine-c14de2e9733685e60f165ee5f2dd1f7c17f3f6cd.tar.gz
go-tangerine-c14de2e9733685e60f165ee5f2dd1f7c17f3f6cd.tar.bz2
go-tangerine-c14de2e9733685e60f165ee5f2dd1f7c17f3f6cd.tar.lz
go-tangerine-c14de2e9733685e60f165ee5f2dd1f7c17f3f6cd.tar.xz
go-tangerine-c14de2e9733685e60f165ee5f2dd1f7c17f3f6cd.tar.zst
go-tangerine-c14de2e9733685e60f165ee5f2dd1f7c17f3f6cd.zip
p2p/nat: tweak port mapping log messages and levels
People stil get confused about the messages. This commit changes the levels so that the only thing printed at the default level (info) is a successful mapping.
Diffstat (limited to 'p2p/nat/nat.go')
-rw-r--r--p2p/nat/nat.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/p2p/nat/nat.go b/p2p/nat/nat.go
index 58d50976d..9acb34398 100644
--- a/p2p/nat/nat.go
+++ b/p2p/nat/nat.go
@@ -86,13 +86,13 @@ func Map(m Interface, c chan struct{}, protocol string, extport, intport int, na
refresh := time.NewTimer(mapUpdateInterval)
defer func() {
refresh.Stop()
- glog.V(logger.Debug).Infof("Deleting port mapping: %s %d -> %d (%s) using %s\n", protocol, extport, intport, name, m)
+ 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)
}()
- 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.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)
+ 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)
}
for {
select {
@@ -101,10 +101,9 @@ func Map(m Interface, c chan struct{}, protocol string, extport, intport int, na
return
}
case <-refresh.C:
- glog.V(logger.Detail).Infof("refresh mapping: %s %d -> %d (%s) using %s\n", protocol, extport, intport, name, m)
+ 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 {
- 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)
+ glog.V(logger.Debug).Infof("network port %s:%d could not be mapped: %v\n", protocol, intport, err)
}
refresh.Reset(mapUpdateInterval)
}