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:
/// [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
/// send buffer).
///
+ /// In order to avoid processing too many messages at once per peer, `data` should be on the
+ /// order of 4KiB.
+ ///
/// [`send_data`]: SocketDescriptor::send_data
/// [`process_events`]: PeerManager::process_events
pub fn read_event(&self, peer_descriptor: &mut Descriptor, data: &[u8]) -> Result<bool, PeerHandleError> {