File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 :
You can’t perform that action at this time.
0 commit comments