From 7ec3fc7a5ab235c04d1dc09ce514f45bed11cb25 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Thu, 19 Oct 2017 09:00:54 +0200 Subject: [PATCH] Prevent negative DownloadChunk in asyncore --- src/network/advanceddispatcher.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/advanceddispatcher.py b/src/network/advanceddispatcher.py index 576eed39..331daf03 100644 --- a/src/network/advanceddispatcher.py +++ b/src/network/advanceddispatcher.py @@ -79,6 +79,8 @@ class AdvancedDispatcher(asyncore.dispatcher): try: if self.expectBytes > 0 and not self.fullyEstablished: self.downloadChunk = min(self.downloadChunk, self.expectBytes - len(self.read_buf)) + if self.downloadChunk < 0: + self.downloadChunk = 0 except AttributeError: pass return asyncore.dispatcher.readable(self) and \