Fix multiple TCP bind address handling
This commit is contained in:
parent
6c695c8ac7
commit
e7231f3aea
|
@ -116,11 +116,12 @@ class BMConnectionPool(object):
|
||||||
host = BMConfigParser().get("network", "bind")
|
host = BMConfigParser().get("network", "bind")
|
||||||
return host
|
return host
|
||||||
|
|
||||||
def startListening(self):
|
def startListening(self, bind=None):
|
||||||
host = self.getListeningIP()
|
if bind is None:
|
||||||
|
bind = self.getListeningIP()
|
||||||
port = BMConfigParser().safeGetInt("bitmessagesettings", "port")
|
port = BMConfigParser().safeGetInt("bitmessagesettings", "port")
|
||||||
# correct port even if it changed
|
# correct port even if it changed
|
||||||
ls = network.tcp.TCPServer(host=host, port=port)
|
ls = network.tcp.TCPServer(host=bind, port=port)
|
||||||
self.listeningSockets[ls.destination] = ls
|
self.listeningSockets[ls.destination] = ls
|
||||||
|
|
||||||
def startUDPSocket(self, bind=None):
|
def startUDPSocket(self, bind=None):
|
||||||
|
@ -192,7 +193,11 @@ class BMConnectionPool(object):
|
||||||
|
|
||||||
if acceptConnections:
|
if acceptConnections:
|
||||||
if not self.listeningSockets:
|
if not self.listeningSockets:
|
||||||
self.startListening()
|
if BMConfigParser().safeGet("network", "bind") == '':
|
||||||
|
self.startListening()
|
||||||
|
else:
|
||||||
|
for bind in re.sub("[^\w.]+", " ", BMConfigParser().safeGet("network", "bind")).split():
|
||||||
|
self.startListening(bind)
|
||||||
logger.info('Listening for incoming connections.')
|
logger.info('Listening for incoming connections.')
|
||||||
if not self.udpSockets:
|
if not self.udpSockets:
|
||||||
if BMConfigParser().safeGet("network", "bind") == '':
|
if BMConfigParser().safeGet("network", "bind") == '':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user