From 05182e7465ee13b2773322489075f277363bf984 Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Wed, 1 Jul 2015 15:26:23 -0400 Subject: [PATCH] Make data send rate more accurate --- src/class_sendDataThread.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/class_sendDataThread.py b/src/class_sendDataThread.py index 742b1b95..bb19c9f6 100644 --- a/src/class_sendDataThread.py +++ b/src/class_sendDataThread.py @@ -82,12 +82,11 @@ class sendDataThread(threading.Thread): uploadRateLimitBytes = 999999999 # float("inf") doesn't work else: uploadRateLimitBytes = shared.config.getint('bitmessagesettings', 'maxuploadrate') * 1000 - numberOfBytesWeMaySend = uploadRateLimitBytes - shared.numberOfBytesSentLastSecond - self.sock.sendall(data[:numberOfBytesWeMaySend]) - shared.numberOfBytesSent += len(data[:numberOfBytesWeMaySend]) # used for the 'network status' tab in the UI - shared.numberOfBytesSentLastSecond += len(data[:numberOfBytesWeMaySend]) + amountSent = self.sock.send(data[:1000]) + shared.numberOfBytesSent += amountSent # used for the 'network status' tab in the UI + shared.numberOfBytesSentLastSecond += amountSent self.lastTimeISentData = int(time.time()) - data = data[numberOfBytesWeMaySend:] + data = data[amountSent:] def run(self):