p2p/nat: delete port mapping before adding (#15222)

Fixes #1024
This commit is contained in:
Darrel Herbst 2017-10-06 07:39:47 -04:00 committed by Felix Lange
parent 5df0b240ae
commit d54e3539d4
1 changed files with 1 additions and 0 deletions

View File

@ -62,6 +62,7 @@ func (n *upnp) AddMapping(protocol string, extport, intport int, desc string, li
} }
protocol = strings.ToUpper(protocol) protocol = strings.ToUpper(protocol)
lifetimeS := uint32(lifetime / time.Second) lifetimeS := uint32(lifetime / time.Second)
n.DeleteMapping(protocol, extport, intport)
return n.client.AddPortMapping("", uint16(extport), protocol, uint16(intport), ip.String(), true, desc, lifetimeS) return n.client.AddPortMapping("", uint16(extport), protocol, uint16(intport), ip.String(), true, desc, lifetimeS)
} }