Skip to content

Commit 1ad30e9

Browse files
committed
Implement zerocopy writes for the WebSocket writer
closes #9633
1 parent c95c025 commit 1ad30e9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

aiohttp/_websocket/writer.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from ..compression_utils import ZLibCompressor
1212
from .helpers import (
1313
MASK_LEN,
14-
MSG_SIZE,
1514
PACK_CLOSE_CODE,
1615
PACK_LEN1,
1716
PACK_LEN2,
@@ -135,13 +134,10 @@ async def send_frame(
135134
mask = PACK_RANDBITS(self.get_random_bits())
136135
message = bytearray(message)
137136
websocket_mask(mask, message)
138-
self.transport.write(header + mask + message)
137+
self.transport.writelines((header, mask, message))
139138
self._output_size += MASK_LEN
140-
elif msg_length > MSG_SIZE:
141-
self.transport.write(header)
142-
self.transport.write(message)
143139
else:
144-
self.transport.write(header + message)
140+
self.transport.write((header, message))
145141

146142
self._output_size += header_len + msg_length
147143

0 commit comments

Comments
 (0)