allowing for max outbound connection configuration #940
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -6,4 +6,6 @@ src/dist
|
|||
src/.project
|
||||
src/.pydevproject
|
||||
src/.settings/
|
||||
*.dll
|
||||
src/**/.dll
|
||||
src/**/*.o
|
||||
src/**/*.so
|
||||
|
|
|
@ -2400,6 +2400,10 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
except:
|
||||
QMessageBox.about(self, _translate("MainWindow", "Number needed"), _translate(
|
||||
"MainWindow", "Your maximum download and upload rate must be numbers. Ignoring what you typed."))
|
||||
|
||||
BMConfigParser().set('bitmessagesettings', 'maxoutboundconnections', str(
|
||||
int(float(self.settingsDialogInstance.ui.lineEditMaxOutboundConnections.text()))))
|
||||
|
||||
throttle.SendThrottle().resetLimit()
|
||||
throttle.ReceiveThrottle().resetLimit()
|
||||
|
||||
|
@ -4108,6 +4112,8 @@ class settingsDialog(QtGui.QDialog):
|
|||
BMConfigParser().get('bitmessagesettings', 'maxdownloadrate')))
|
||||
self.ui.lineEditMaxUploadRate.setText(str(
|
||||
BMConfigParser().get('bitmessagesettings', 'maxuploadrate')))
|
||||
self.ui.lineEditMaxOutboundConnections.setText(str(
|
||||
BMConfigParser().get('bitmessagesettings', 'maxoutboundconnections')))
|
||||
|
||||
# Demanded difficulty tab
|
||||
self.ui.lineEditTotalDifficulty.setText(str((float(BMConfigParser().getint(
|
||||
|
|
|
@ -154,6 +154,19 @@ class Ui_settingsDialog(object):
|
|||
self.lineEditMaxUploadRate.setMaximumSize(QtCore.QSize(60, 16777215))
|
||||
self.lineEditMaxUploadRate.setObjectName(_fromUtf8("lineEditMaxUploadRate"))
|
||||
self.gridLayout_9.addWidget(self.lineEditMaxUploadRate, 1, 2, 1, 1)
|
||||
self.label_26 = QtGui.QLabel(self.groupBox_3)
|
||||
self.label_26.setObjectName(_fromUtf8("label_26"))
|
||||
self.gridLayout_9.addWidget(self.label_26, 2, 1, 1, 1)
|
||||
self.lineEditMaxOutboundConnections = QtGui.QLineEdit(self.groupBox_3)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.lineEditMaxOutboundConnections.sizePolicy().hasHeightForWidth())
|
||||
self.lineEditMaxOutboundConnections.setSizePolicy(sizePolicy)
|
||||
self.lineEditMaxOutboundConnections.setMaximumSize(QtCore.QSize(60, 16777215))
|
||||
self.lineEditMaxOutboundConnections.setObjectName(_fromUtf8("lineEditMaxOutboundConnections"))
|
||||
self.lineEditMaxOutboundConnections.setValidator(QtGui.QIntValidator(0, 4096, self.lineEditMaxOutboundConnections))
|
||||
self.gridLayout_9.addWidget(self.lineEditMaxOutboundConnections, 2, 2, 1, 1)
|
||||
self.gridLayout_4.addWidget(self.groupBox_3, 2, 0, 1, 1)
|
||||
self.groupBox_2 = QtGui.QGroupBox(self.tabNetworkSettings)
|
||||
self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
|
||||
|
@ -459,6 +472,7 @@ class Ui_settingsDialog(object):
|
|||
self.groupBox_3.setTitle(_translate("settingsDialog", "Bandwidth limit", None))
|
||||
self.label_24.setText(_translate("settingsDialog", "Maximum download rate (kB/s): [0: unlimited]", None))
|
||||
self.label_25.setText(_translate("settingsDialog", "Maximum upload rate (kB/s): [0: unlimited]", None))
|
||||
self.label_26.setText(_translate("settingsDialog", "Maximum outbound connections: [0: none]", None))
|
||||
self.groupBox_2.setTitle(_translate("settingsDialog", "Proxy server / Tor", None))
|
||||
self.label_2.setText(_translate("settingsDialog", "Type:", None))
|
||||
self.label_3.setText(_translate("settingsDialog", "Server hostname:", None))
|
||||
|
|
|
@ -317,6 +317,29 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="text">
|
||||
<string>Maximum outbound connections: [0: none]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="lineEditMaxOutboundConnections">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -78,7 +78,7 @@ class outgoingSynSender(threading.Thread, StoppableThread):
|
|||
self.stop.wait(2)
|
||||
|
||||
while BMConfigParser().safeGetBoolean('bitmessagesettings', 'sendoutgoingconnections') and not self._stopped:
|
||||
self.name = "outgoingSynSender"
|
||||
maximumConnections = 1 if state.trustedPeer else 8 # maximum number of outgoing connections = 8
|
||||
maximumConnections = 1 if state.trustedPeer else BMConfigParser().safeGetInt('bitmessagesettings', 'maxoutboundconnections')
|
||||
while len(self.selfInitiatedConnections[self.streamNumber]) >= maximumConnections and not self._stopped:
|
||||
self.stop.wait(10)
|
||||
if state.shutdown:
|
||||
|
|
|
@ -434,6 +434,16 @@ class sqlThread(threading.Thread):
|
|||
BMConfigParser().set('bitmessagesettings', 'smtpdeliver', '')
|
||||
if not BMConfigParser().has_option('bitmessagesettings', 'hidetrayconnectionnotifications'):
|
||||
BMConfigParser().set('bitmessagesettings', 'hidetrayconnectionnotifications', 'false')
|
||||
if BMConfigParser().has_option('bitmessagesettings', 'maxoutboundconnections'):
|
||||
try:
|
||||
if BMConfigParser().getint('bitmessagesettings', 'maxoutboundconnections') < 1: raise ValueError
|
||||
except ValueError as err:
|
||||
BMConfigParser().remove_option('bitmessagesettings', 'maxoutboundconnections')
|
||||
logger.error('Your maximum outbound connections must be a number.')
|
||||
if not BMConfigParser().has_option('bitmessagesettings', 'maxoutboundconnections'):
|
||||
logger.info('Setting maximum outbound connections to 8.')
|
||||
BMConfigParser().set('bitmessagesettings', 'maxoutboundconnections', '8')
|
||||
|
||||
BMConfigParser().save()
|
||||
|
||||
# Are you hoping to add a new option to the keys.dat file of existing
|
||||
|
|
|
@ -107,6 +107,7 @@ def loadConfig():
|
|||
BMConfigParser().set('bitmessagesettings', 'replybelow', 'False')
|
||||
BMConfigParser().set('bitmessagesettings', 'maxdownloadrate', '0')
|
||||
BMConfigParser().set('bitmessagesettings', 'maxuploadrate', '0')
|
||||
BMConfigParser().set('bitmessagesettings', 'maxoutboundconnections', '8')
|
||||
BMConfigParser().set('bitmessagesettings', 'ttl', '367200')
|
||||
|
||||
#start:UI setting to stop trying to send messages after X days/months
|
||||
|
|
Reference in New Issue
Block a user
please change getint to safeGetInt