Revert "Implement zlib streaming for the gateway."

This reverts commit 462191a08b.
This commit is contained in:
Rapptz
2017-10-14 15:22:39 -04:00
parent 462191a08b
commit 92a37c2e4f
2 changed files with 6 additions and 26 deletions

View File

@ -186,8 +186,6 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
# ws related stuff
self.session_id = None
self.sequence = None
self._zlib = zlib.decompressobj()
self._buffer = bytearray()
@classmethod
@asyncio.coroutine
@ -314,18 +312,8 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
self._dispatch('socket_raw_receive', msg)
if isinstance(msg, bytes):
self._buffer.extend(msg)
if len(msg) >= 4:
suffix = int.from_bytes(msg[-4:], byteorder='big')
if suffix == 0xFFFF:
msg = self._zlib.decompress(self._buffer)
msg = msg.decode('utf-8')
self._buffer = bytearray()
else:
return
else:
return
msg = zlib.decompress(msg, 15, 10490000) # This is 10 MiB
msg = msg.decode('utf-8')
msg = json.loads(msg)