justheuristic 3 years ago
parent
commit
e4b1984030
1 changed files with 4 additions and 4 deletions
  1. 4 4
      hivemind/p2p/p2p_daemon_bindings/control.py

+ 4 - 4
hivemind/p2p/p2p_daemon_bindings/control.py

@@ -49,11 +49,11 @@ class DaemonConnector:
     async def open_connection(self) -> (asyncio.StreamReader, asyncio.StreamWriter):
         if self.proto_code == protocols.P_UNIX:
             control_path = self.control_maddr.value_for_protocol(protocols.P_UNIX)
-            return await asyncio.open_unix_connection(control_path, limit=2**30)
+            return await asyncio.open_unix_connection(control_path, limit=2 ** 18)
         elif self.proto_code == protocols.P_IP4:
             host = self.control_maddr.value_for_protocol(protocols.P_IP4)
             port = int(self.control_maddr.value_for_protocol(protocols.P_TCP))
-            return await asyncio.open_connection(host, port, limit=2**30)
+            return await asyncio.open_connection(host, port, limit=2 ** 18)
         else:
             raise ValueError(f"Protocol not supported: {protocols.protocol_with_code(self.proto_code)}")
 
@@ -62,7 +62,7 @@ class DaemonConnector:
         Open connection to daemon and upgrade it to a persistent one
         """
         reader, writer = await self.open_connection()
-        writer.transport.set_write_buffer_limits(low=2 ** 20, high=2 ** 24)
+        writer.transport.set_write_buffer_limits(low=2 ** 16, high=2 ** 18)
         req = p2pd_pb.Request(type=p2pd_pb.Request.PERSISTENT_CONN_UPGRADE)
         await write_pbmsg(writer, req)
 
@@ -345,7 +345,7 @@ class ControlClient:
         self, peer_id: PeerID, protocols: Sequence[str]
     ) -> Tuple[StreamInfo, asyncio.StreamReader, asyncio.StreamWriter]:
         reader, writer = await self.daemon_connector.open_connection()
-        writer.transport.set_write_buffer_limits(low=2 ** 20, high=2 ** 24)
+        writer.transport.set_write_buffer_limits(low=2 ** 16, high=2 ** 18)
 
         stream_open_req = p2pd_pb.StreamOpenRequest(peer=peer_id.to_bytes(), proto=list(protocols))
         req = p2pd_pb.Request(type=p2pd_pb.Request.STREAM_OPEN, streamOpen=stream_open_req)