From 626ebd9b27db58d9db177baabcaf7433f257d404 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 7 Aug 2018 18:35:38 -0400 Subject: [PATCH] fix miniupnpc response format --- txupnp/__init__.py | 2 +- txupnp/scpd.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/txupnp/__init__.py b/txupnp/__init__.py index b7dc9ef..71c452f 100644 --- a/txupnp/__init__.py +++ b/txupnp/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.0.1a7" +__version__ = "0.0.1a8" __name__ = "txupnp" __author__ = "Jack Robison" __maintainer__ = "Jack Robison" diff --git a/txupnp/scpd.py b/txupnp/scpd.py index ec0b6d7..0c8da65 100644 --- a/txupnp/scpd.py +++ b/txupnp/scpd.py @@ -385,6 +385,7 @@ class UPnPFallback(object): raise NotImplementedError() @return_types(none_or_str, int, str, int, str, bool, str, int) + @defer.inlineCallbacks def GetGenericPortMappingEntry(self, NewPortMappingIndex): """ Returns (NewRemoteHost, NewExternalPort, NewProtocol, NewInternalPort, NewInternalClient, NewEnabled, @@ -392,7 +393,11 @@ class UPnPFallback(object): """ if not self.available: raise NotImplementedError() - return threads.deferToThread(self._upnp.getgenericportmapping, NewPortMappingIndex) + result = yield threads.deferToThread(self._upnp.getgenericportmapping, NewPortMappingIndex) + if not result: + raise UPnPError() + ext_port, protocol, (int_host, int_port), desc, enabled, remote_host, lease = result + defer.returnValue((remote_host, ext_port, protocol, int_port, int_host, enabled, desc, lease)) @return_types(int, str, bool, str, int) def GetSpecificPortMappingEntry(self, NewRemoteHost, NewExternalPort, NewProtocol):