MCPcopy Create free account
hub / github.com/aio-libs/aiohttp / flush

Method flush

aiohttp/compression_utils.py:252–265  ·  view source on GitHub ↗

Flush the compressor synchronously. **WARNING: This method is NOT cancellation-safe when called after compress().** The flush() operation accesses shared compressor state. If compress() was cancelled, calling flush() may result in corrupted data. The connection MUST

(self, mode: int | None = None)

Source from the content-addressed store, hash-verified

250 return self.compress_sync(data)
251
252 def flush(self, mode: int | None = None) -> bytes:
253 """Flush the compressor synchronously.
254
255 **WARNING: This method is NOT cancellation-safe when called after compress().**
256 The flush() operation accesses shared compressor state. If compress() was
257 cancelled, calling flush() may result in corrupted data. The connection MUST
258 be closed after compress() cancellation.
259
260 For cancellation-safe compression (e.g., WebSocket), the caller MUST wrap
261 compress() + flush() + send operations in a shield and lock to ensure atomicity.
262 """
263 return self._compressor.flush(
264 mode if mode is not None else self._zlib_backend.Z_FINISH
265 )
266
267
268class ZLibDecompressor(DecompressionBaseHandler):

Callers 15

_do_start_compressionMethod · 0.95
feed_eofMethod · 0.45
flushMethod · 0.45
flushMethod · 0.45
write_eofMethod · 0.45
write_eofMethod · 0.45
handlerFunction · 0.45

Calls

no outgoing calls