Added warnings about changing port settings in api and network.tcp

This commit is contained in:
Dmitri Bogomolov 2019-08-14 18:34:34 +03:00
parent d2a896697d
commit bbdbca253b
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 6 additions and 1 deletions

View File

@ -95,6 +95,8 @@ class singleAPI(StoppableThread):
for attempt in range(50):
try:
if attempt > 0:
logger.warning(
'Failed to start API listener on port %s', port)
port = random.randint(32767, 65535)
se = StoppableXMLRPCServer(
(BMConfigParser().get(
@ -106,8 +108,9 @@ class singleAPI(StoppableThread):
continue
else:
if attempt > 0:
logger.warning('Setting apiport to %s', port)
BMConfigParser().set(
"bitmessagesettings", "apiport", str(port))
'bitmessagesettings', 'apiport', str(port))
BMConfigParser().save()
break
se.register_introspection_functions()

View File

@ -371,6 +371,7 @@ class TCPServer(AdvancedDispatcher):
for attempt in range(50):
try:
if attempt > 0:
logger.warning('Failed to bind on port %s', port)
port = random.randint(32767, 65535)
self.bind((host, port))
except socket.error as e:
@ -378,6 +379,7 @@ class TCPServer(AdvancedDispatcher):
continue
else:
if attempt > 0:
logger.warning('Setting port to %s', port)
BMConfigParser().set(
'bitmessagesettings', 'port', str(port))
BMConfigParser().save()