From 20abba71d029fa339a033357be6ec47badc4fab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Mon, 29 Apr 2019 17:05:25 +0200 Subject: [PATCH] UPnP: port mapping check no longer a show stopper --- eth/net/nat.nim | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/eth/net/nat.nim b/eth/net/nat.nim index b8891d3..08c287a 100644 --- a/eth/net/nat.nim +++ b/eth/net/nat.nim @@ -116,16 +116,15 @@ proc doPortMapping(tcpPort, udpPort: Port, description: string): Option[(Port, P let cres = upnp.getSpecificPortMapping(externalPort = $port, protocol = protocol) if cres.isErr: - error "UPnP port mapping check", msg = cres.error - return - else: - let extPort = Port(parseUInt(cres.value.externalPort)) - debug "UPnP: added port mapping", externalPort = extPort, internalPort = port, protocol = protocol - case protocol: - of UPNPProtocol.TCP: - extTcpPort = extPort - of UPNPProtocol.UDP: - extUdpPort = extPort + warn "UPnP port mapping check failed. Assuming the check itself is broken and the port mapping was done.", msg = cres.error + + let extPort = Port(parseUInt(cres.value.externalPort)) + debug "UPnP: added port mapping", externalPort = extPort, internalPort = port, protocol = protocol + case protocol: + of UPNPProtocol.TCP: + extTcpPort = extPort + of UPNPProtocol.UDP: + extUdpPort = extPort elif strategy == NatPmp: for t in [(tcpPort, NatPmpProtocol.TCP), (udpPort, NatPmpProtocol.UDP)]: let