Skip to content

Commit

Permalink
Implement zerocopy writes for the WebSocket writer
Browse files Browse the repository at this point in the history
closes #9633
  • Loading branch information
bdraco committed Nov 3, 2024
1 parent b682d8a commit 126667f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions aiohttp/_websocket/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from ..compression_utils import ZLibCompressor
from .helpers import (
MASK_LEN,
MSG_SIZE,
PACK_CLOSE_CODE,
PACK_LEN1,
PACK_LEN2,
Expand Down Expand Up @@ -135,13 +134,10 @@ async def send_frame(
mask = PACK_RANDBITS(self.get_random_bits())
message = bytearray(message)
websocket_mask(mask, message)
self.transport.write(header + mask + message)
self.transport.writelines((header, mask, message))
self._output_size += MASK_LEN
elif msg_length > MSG_SIZE:
self.transport.write(header)
self.transport.write(message)
else:
self.transport.write(header + message)
self.transport.write((header, message))

self._output_size += header_len + msg_length

Expand Down

0 comments on commit 126667f

Please sign in to comment.