UPnP fixes:
- external port iterator fix - error handler fix
This commit is contained in:
parent
7dcd2382a4
commit
390bab2a3a
|
@ -160,7 +160,7 @@ class Router:
|
||||||
logger.error("UPnP error: %s", respData)
|
logger.error("UPnP error: %s", respData)
|
||||||
raise UPnPError(errinfo[0].childNodes[0].data)
|
raise UPnPError(errinfo[0].childNodes[0].data)
|
||||||
except:
|
except:
|
||||||
raise UPnPError("Unable to parse SOAP error: %s", respData)
|
raise UPnPError("Unable to parse SOAP error: %s" %(respData))
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
class uPnPThread(threading.Thread, StoppableThread):
|
class uPnPThread(threading.Thread, StoppableThread):
|
||||||
|
@ -194,7 +194,10 @@ class uPnPThread(threading.Thread, StoppableThread):
|
||||||
lastSent = 0
|
lastSent = 0
|
||||||
while shared.shutdown == 0 and shared.safeConfigGetBoolean('bitmessagesettings', 'upnp'):
|
while shared.shutdown == 0 and shared.safeConfigGetBoolean('bitmessagesettings', 'upnp'):
|
||||||
if time.time() - lastSent > self.sendSleep and len(self.routers) == 0:
|
if time.time() - lastSent > self.sendSleep and len(self.routers) == 0:
|
||||||
self.sendSearchRouter()
|
try:
|
||||||
|
self.sendSearchRouter()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
lastSent = time.time()
|
lastSent = time.time()
|
||||||
try:
|
try:
|
||||||
while shared.shutdown == 0 and shared.safeConfigGetBoolean('bitmessagesettings', 'upnp'):
|
while shared.shutdown == 0 and shared.safeConfigGetBoolean('bitmessagesettings', 'upnp'):
|
||||||
|
@ -269,7 +272,7 @@ class uPnPThread(threading.Thread, StoppableThread):
|
||||||
extPort = self.extPort # try external port from last time next
|
extPort = self.extPort # try external port from last time next
|
||||||
else:
|
else:
|
||||||
extPort = randint(32767, 65535)
|
extPort = randint(32767, 65535)
|
||||||
logger.debug("Requesting UPnP mapping for %s:%i on external port %i", localIP, self.localPort, extPort)
|
logger.debug("Attempt %i, requesting UPnP mapping for %s:%i on external port %i", i, localIP, self.localPort, extPort)
|
||||||
router.AddPortMapping(extPort, self.localPort, localIP, 'TCP', 'BitMessage')
|
router.AddPortMapping(extPort, self.localPort, localIP, 'TCP', 'BitMessage')
|
||||||
shared.extPort = extPort
|
shared.extPort = extPort
|
||||||
self.extPort = extPort
|
self.extPort = extPort
|
||||||
|
|
Loading…
Reference in New Issue
Block a user