allowing for max connection configuration #939

Closed
ghost wants to merge 6 commits from maxconnection-config into v0.6
Showing only changes of commit 37f69646e9 - Show all commits

View File

@ -433,8 +433,16 @@ class sqlThread(threading.Thread):
BMConfigParser().set('bitmessagesettings', 'smtpdeliver', '')
if not BMConfigParser().has_option('bitmessagesettings', 'hidetrayconnectionnotifications'):
BMConfigParser().set('bitmessagesettings', 'hidetrayconnectionnotifications', 'false')
if not BMConfigParser().has_option('bitmessagesettings', 'maxoutboundconnections'):
if BMConfigParser().has_option('bitmessagesettings', 'maxoutboundconnections'):
try:
# Ensure we have an integer
int(float(BMConfigParser().get('bitmessagesettings', 'maxoutboundconnections')))
PeterSurda commented 2017-01-11 21:23:02 +01:00 (Migrated from github.com)
Review

Maybe
if BMConfigParser().getint('bitmessagesettings', 'maxoutboundconnections'))) < 1: throw ValueException

Maybe `if BMConfigParser().getint('bitmessagesettings', 'maxoutboundconnections'))) < 1: throw ValueException `
except:
PeterSurda commented 2017-01-11 21:24:15 +01:00 (Migrated from github.com)
Review

And this should be
except ValueException:
because you're supposed to always name the exception. I haven't always done it but in new code we should try to do that.

And this should be `except ValueException:` because you're supposed to always name the exception. I haven't always done it but in new code we should try to do that.
logger.fatal('Your maximum outbound connections must be a number.')
PeterSurda commented 2017-01-11 21:02:28 +01:00 (Migrated from github.com)
Review

This should simply log an error and set it to 8 instead of dying.

This should simply log an error and set it to 8 instead of dying.
os._exit(0)
else:
BMConfigParser().set('bitmessagesettings', 'maxoutboundconnections', '8')
shared.writeKeysFile()
# Are you hoping to add a new option to the keys.dat file of existing