mirror of https://github.com/status-im/nim-eth.git
one upnp is enough (#324)
we shouldn't have to recreate the upnp interface every time
This commit is contained in:
parent
ab969f72c1
commit
51a8795e56
|
@ -42,7 +42,9 @@ proc getExternalIP*(natStrategy: NatStrategy, quiet = false): Option[IpAddress]
|
||||||
var externalIP: IPAddress
|
var externalIP: IPAddress
|
||||||
|
|
||||||
if natStrategy == NatAny or natStrategy == NatUpnp:
|
if natStrategy == NatAny or natStrategy == NatUpnp:
|
||||||
upnp = newMiniupnp()
|
if upnp == nil:
|
||||||
|
upnp = newMiniupnp()
|
||||||
|
|
||||||
upnp.discoverDelay = UPNP_TIMEOUT
|
upnp.discoverDelay = UPNP_TIMEOUT
|
||||||
let dres = upnp.discover()
|
let dres = upnp.discover()
|
||||||
if dres.isErr:
|
if dres.isErr:
|
||||||
|
@ -78,7 +80,8 @@ proc getExternalIP*(natStrategy: NatStrategy, quiet = false): Option[IpAddress]
|
||||||
return
|
return
|
||||||
|
|
||||||
if natStrategy == NatAny or natStrategy == NatPmp:
|
if natStrategy == NatAny or natStrategy == NatPmp:
|
||||||
npmp = newNatPmp()
|
if npmp == nil:
|
||||||
|
npmp = newNatPmp()
|
||||||
let nres = npmp.init()
|
let nres = npmp.init()
|
||||||
if nres.isErr:
|
if nres.isErr:
|
||||||
debug "NAT-PMP", msg = nres.error
|
debug "NAT-PMP", msg = nres.error
|
||||||
|
|
Loading…
Reference in New Issue