mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 22:56:43 +00:00
p2p/nat: addAnyPortMapping now replaces addPortMapping
The default of addAnyPortMapping is what addPortMapping does, so no need to call it separately. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
12c17e344d
commit
343277d9a1
1 changed files with 1 additions and 7 deletions
|
|
@ -94,13 +94,7 @@ func (n *upnp) AddMapping(protocol string, extport, intport int, desc string, li
|
|||
n.DeleteMapping(protocol, extport, intport)
|
||||
}
|
||||
|
||||
err = n.withRateLimit(func() error {
|
||||
return n.client.AddPortMapping("", uint16(extport), protocol, uint16(intport), ip.String(), true, desc, lifetimeS)
|
||||
})
|
||||
if err == nil {
|
||||
return uint16(extport), nil
|
||||
}
|
||||
// Try addAnyPortMapping if mapping specified port didn't work.
|
||||
// Try to add port mapping, preferring the specified external port.
|
||||
err = n.withRateLimit(func() error {
|
||||
p, err := n.addAnyPortMapping(protocol, extport, intport, ip, desc, lifetimeS)
|
||||
if err == nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue