aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/nat
diff options
context:
space:
mode:
authorDarrel Herbst <dherbst@gmail.com>2017-10-06 19:39:47 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-10-06 19:39:47 +0800
commitd54e3539d453c78e30d950706f6465743723a33c (patch)
tree37d83a2bbb36a45651ddf2851090a61f80671fbc /p2p/nat
parent5df0b240ae35b5c525323fff355922df44616150 (diff)
downloaddexon-d54e3539d453c78e30d950706f6465743723a33c.tar.gz
dexon-d54e3539d453c78e30d950706f6465743723a33c.tar.zst
dexon-d54e3539d453c78e30d950706f6465743723a33c.zip
p2p/nat: delete port mapping before adding (#15222)
Fixes #1024
Diffstat (limited to 'p2p/nat')
-rw-r--r--p2p/nat/natupnp.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/p2p/nat/natupnp.go b/p2p/nat/natupnp.go
index 6b3fa3f7a..69099ac04 100644
--- a/p2p/nat/natupnp.go
+++ b/p2p/nat/natupnp.go
@@ -62,6 +62,7 @@ func (n *upnp) AddMapping(protocol string, extport, intport int, desc string, li
}
protocol = strings.ToUpper(protocol)
lifetimeS := uint32(lifetime / time.Second)
+ n.DeleteMapping(protocol, extport, intport)
return n.client.AddPortMapping("", uint16(extport), protocol, uint16(intport), ip.String(), true, desc, lifetimeS)
}