fix miniupnpc response format

This commit is contained in:
Jack Robison 2018-08-07 18:35:38 -04:00
parent 78e81a1dff
commit 626ebd9b27
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 7 additions and 2 deletions

View file

@ -1,4 +1,4 @@
__version__ = "0.0.1a7" __version__ = "0.0.1a8"
__name__ = "txupnp" __name__ = "txupnp"
__author__ = "Jack Robison" __author__ = "Jack Robison"
__maintainer__ = "Jack Robison" __maintainer__ = "Jack Robison"

View file

@ -385,6 +385,7 @@ class UPnPFallback(object):
raise NotImplementedError() raise NotImplementedError()
@return_types(none_or_str, int, str, int, str, bool, str, int) @return_types(none_or_str, int, str, int, str, bool, str, int)
@defer.inlineCallbacks
def GetGenericPortMappingEntry(self, NewPortMappingIndex): def GetGenericPortMappingEntry(self, NewPortMappingIndex):
""" """
Returns (NewRemoteHost, NewExternalPort, NewProtocol, NewInternalPort, NewInternalClient, NewEnabled, Returns (NewRemoteHost, NewExternalPort, NewProtocol, NewInternalPort, NewInternalClient, NewEnabled,
@ -392,7 +393,11 @@ class UPnPFallback(object):
""" """
if not self.available: if not self.available:
raise NotImplementedError() 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) @return_types(int, str, bool, str, int)
def GetSpecificPortMappingEntry(self, NewRemoteHost, NewExternalPort, NewProtocol): def GetSpecificPortMappingEntry(self, NewRemoteHost, NewExternalPort, NewProtocol):