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
|
||||
|
||||
if natStrategy == NatAny or natStrategy == NatUpnp:
|
||||
if upnp == nil:
|
||||
upnp = newMiniupnp()
|
||||
|
||||
upnp.discoverDelay = UPNP_TIMEOUT
|
||||
let dres = upnp.discover()
|
||||
if dres.isErr:
|
||||
|
@ -78,6 +80,7 @@ proc getExternalIP*(natStrategy: NatStrategy, quiet = false): Option[IpAddress]
|
|||
return
|
||||
|
||||
if natStrategy == NatAny or natStrategy == NatPmp:
|
||||
if npmp == nil:
|
||||
npmp = newNatPmp()
|
||||
let nres = npmp.init()
|
||||
if nres.isErr:
|
||||
|
|
Loading…
Reference in New Issue