Suggest a socket read buffer of 4KiB to limit message count
[rust-lightning] / lightning-net-tokio / src / lib.rs
index 9616e0db61d437285361ac6c33c36b664a60eed2..b259f77eff8f9ace67fec3b2a666122b0ae3c12a 100644 (file)
@@ -176,8 +176,9 @@ impl Connection {
                let (event_waker, event_receiver) = mpsc::channel(1);
                tokio::spawn(Self::poll_event_process(peer_manager.clone(), event_receiver));
 
-               // 8KB is nice and big but also should never cause any issues with stack overflowing.
-               let mut buf = [0; 8192];
+               // 4KiB is nice and big without handling too many messages all at once, giving other peers
+               // a chance to do some work.
+               let mut buf = [0; 4096];
 
                let mut our_descriptor = SocketDescriptor::new(us.clone());
                // An enum describing why we did/are disconnecting: