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

View File

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