Prevent negative DownloadChunk in asyncore

This commit is contained in:
Peter Šurda 2017-10-19 09:00:54 +02:00
parent f785558ca5
commit 7ec3fc7a5a
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -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 \