Skip to content

Commit 851178f

Browse files
committed
Double the max read size
1 parent e4f856e commit 851178f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

mypy/ipc.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@
3838
_IPCHandle = socket.socket
3939

4040
# Size of the message packed as !L, i.e. 4 bytes in network order (big-endian).
41-
HEADER_SIZE = 4
41+
HEADER_SIZE: Final = 4
42+
43+
# This is Linux default socket buffer size (for 64 bit), so we will not
44+
# introduce an additional obstacle when exchanging a large IPC message.
45+
MAX_READ: Final = 212992
4246

4347

4448
# TODO: we should make sure consistent exceptions are raised on different platforms.
@@ -80,10 +84,10 @@ def frame_from_buffer(self) -> bytes | None:
8084
self.message_size = None
8185
return bytes(bdata)
8286

83-
def read(self, size: int = 100000) -> str:
87+
def read(self, size: int = MAX_READ) -> str:
8488
return self.read_bytes(size).decode("utf-8")
8589

86-
def read_bytes(self, size: int = 100000) -> bytes:
90+
def read_bytes(self, size: int = MAX_READ) -> bytes:
8791
"""Read bytes from an IPC connection until we have a full frame."""
8892
if sys.platform == "win32":
8993
while True:

0 commit comments

Comments
 (0)