From b8df5976eb141b3470033382a6bca4251ba12475 Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Fri, 25 Jan 2013 14:39:22 -0500 Subject: [PATCH] skip the slow message 'leaking' functionality if tens of messages are queued waiting to be sent --- bitmessagemain.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bitmessagemain.py b/bitmessagemain.py index bbc4e964..b54c0690 100644 --- a/bitmessagemain.py +++ b/bitmessagemain.py @@ -1162,7 +1162,6 @@ class receiveDataThread(QThread): printLock.release() return if addressVersion == 2: - print 'within recpubkey, the self.payloadLength is', self.payloadLength,'. It should be 146.' if self.payloadLength < 146: #sanity check. This is the minimum possible length. print 'payloadLength less than 146. Sanity check failed.' return @@ -1819,9 +1818,10 @@ class sendDataThread(QThread): self.streamNumber = specifiedStreamNumber elif command == 'send': try: - #To prevent some network analysis, 'leak' the data out to our peer after waiting a random amount of time. - random.seed() - time.sleep(random.randrange(0, 10)) + #To prevent some network analysis, 'leak' the data out to our peer after waiting a random amount of time unless we have a long list of messages in our queue to send. + if self.mailbox.qsize() < 20: + random.seed() + time.sleep(random.randrange(0, 10)) self.sock.sendall(data) self.lastTimeISentData = int(time.time()) except: