Apply bandwidth limits without restart
- also minor style fixes
This commit is contained in:
parent
bcc5a210a4
commit
1864762a0a
|
@ -69,7 +69,7 @@ import queues
|
|||
import shutdown
|
||||
import state
|
||||
from statusbar import BMStatusBar
|
||||
import throttle
|
||||
from network.asyncore_pollchoose import set_rates
|
||||
from version import softwareVersion
|
||||
import sound
|
||||
|
||||
|
@ -2288,16 +2288,16 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
int(float(self.settingsDialogInstance.ui.lineEditMaxDownloadRate.text()))))
|
||||
BMConfigParser().set('bitmessagesettings', 'maxuploadrate', str(
|
||||
int(float(self.settingsDialogInstance.ui.lineEditMaxUploadRate.text()))))
|
||||
except:
|
||||
except ValueError:
|
||||
QMessageBox.about(self, _translate("MainWindow", "Number needed"), _translate(
|
||||
"MainWindow", "Your maximum download and upload rate must be numbers. Ignoring what you typed."))
|
||||
else:
|
||||
set_rates(BMConfigParser().safeGetInt("bitmessagesettings", "maxdownloadrate"),
|
||||
BMConfigParser().safeGetInt("bitmessagesettings", "maxuploadrate"))
|
||||
|
||||
BMConfigParser().set('bitmessagesettings', 'maxoutboundconnections', str(
|
||||
int(float(self.settingsDialogInstance.ui.lineEditMaxOutboundConnections.text()))))
|
||||
|
||||
throttle.SendThrottle().resetLimit()
|
||||
throttle.ReceiveThrottle().resetLimit()
|
||||
|
||||
BMConfigParser().set('bitmessagesettings', 'namecoinrpctype',
|
||||
self.settingsDialogInstance.getNamecoinType())
|
||||
BMConfigParser().set('bitmessagesettings', 'namecoinrpchost', str(
|
||||
|
|
|
@ -129,8 +129,8 @@ def write(obj):
|
|||
|
||||
def set_rates(download, upload):
|
||||
global maxDownloadRate, maxUploadRate, downloadBucket, uploadBucket, downloadTimestamp, uploadTimestamp
|
||||
maxDownloadRate = float(download)
|
||||
maxUploadRate = float(upload)
|
||||
maxDownloadRate = float(download) * 1024
|
||||
maxUploadRate = float(upload) * 1024
|
||||
downloadBucket = maxDownloadRate
|
||||
uploadBucket = maxUploadRate
|
||||
downloadTimestamp = time.time()
|
||||
|
|
|
@ -22,8 +22,8 @@ import state
|
|||
class BMConnectionPool(object):
|
||||
def __init__(self):
|
||||
asyncore.set_rates(
|
||||
BMConfigParser().safeGetInt("bitmessagesettings", "maxdownloadrate") * 1024,
|
||||
BMConfigParser().safeGetInt("bitmessagesettings", "maxuploadrate") * 1024)
|
||||
BMConfigParser().safeGetInt("bitmessagesettings", "maxdownloadrate"),
|
||||
BMConfigParser().safeGetInt("bitmessagesettings", "maxuploadrate"))
|
||||
self.outboundConnections = {}
|
||||
self.inboundConnections = {}
|
||||
self.listeningSockets = {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user