mirror of https://gitlab.com/litecord/litecord.git
parent
d77a84be97
commit
f792769656
|
|
@ -268,16 +268,13 @@ class GatewayWebsocket:
|
||||||
"""Split data in chunk_size-big chunks and send them
|
"""Split data in chunk_size-big chunks and send them
|
||||||
over the websocket."""
|
over the websocket."""
|
||||||
log.debug(
|
log.debug(
|
||||||
"zlib-stream: chunking {} bytes into {}-byte chunks", len(data), chunk_size
|
"zlib-stream: sending {} bytes into {}-byte chunks", len(data), chunk_size
|
||||||
)
|
)
|
||||||
|
|
||||||
total_chunks = 0
|
# we send the entire iterator as per websockets documentation
|
||||||
for chunk in yield_chunks(data, chunk_size):
|
# to pretent setting FIN when we don't want to
|
||||||
total_chunks += 1
|
# see https://gitlab.com/litecord/litecord/-/issues/139
|
||||||
log.debug("zlib-stream: chunk {}", total_chunks)
|
await self.ws.send(yield_chunks(data, chunk_size))
|
||||||
await self.ws.send(chunk)
|
|
||||||
|
|
||||||
log.debug("zlib-stream: sent {} chunks", total_chunks)
|
|
||||||
|
|
||||||
async def _zlib_stream_send(self, encoded):
|
async def _zlib_stream_send(self, encoded):
|
||||||
"""Sending a single payload across multiple compressed
|
"""Sending a single payload across multiple compressed
|
||||||
|
|
@ -314,7 +311,7 @@ class GatewayWebsocket:
|
||||||
|
|
||||||
# clients should handle chunked sends (via detection
|
# clients should handle chunked sends (via detection
|
||||||
# of the ZLIB_SUFFIX suffix appended to data2), so
|
# of the ZLIB_SUFFIX suffix appended to data2), so
|
||||||
# this shouldn't being problems.
|
# this shouldn't cause problems.
|
||||||
|
|
||||||
# TODO: the chunks are 1024 bytes, 1KB, is this good enough?
|
# TODO: the chunks are 1024 bytes, 1KB, is this good enough?
|
||||||
await self._chunked_send(data1, 1024)
|
await self._chunked_send(data1, 1024)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue