perf: disable nagle algorithm for rlpx sessions (#4944)

This commit is contained in:
Matthias Seitz
2023-10-10 00:09:09 +02:00
committed by GitHub
parent e474c0d73b
commit 1cccd097eb
2 changed files with 9 additions and 1 deletions

View File

@ -42,6 +42,9 @@ impl ConnectionListener {
let this = self.project();
match ready!(this.incoming.poll_next(cx)) {
Some(Ok((stream, remote_addr))) => {
if let Err(err) = stream.set_nodelay(true) {
tracing::warn!(target : "net", "set nodelay failed: {:?}", err);
}
Poll::Ready(ListenerEvent::Incoming { stream, remote_addr })
}
Some(Err(err)) => Poll::Ready(ListenerEvent::Error(err)),

View File

@ -759,7 +759,12 @@ async fn start_pending_outbound_session(
bandwidth_meter: BandwidthMeter,
) {
let stream = match TcpStream::connect(remote_addr).await {
Ok(stream) => MeteredStream::new_with_meter(stream, bandwidth_meter),
Ok(stream) => {
if let Err(err) = stream.set_nodelay(true) {
tracing::warn!(target : "net::session", "set nodelay failed: {:?}", err);
}
MeteredStream::new_with_meter(stream, bandwidth_meter)
}
Err(error) => {
let _ = events
.send(PendingSessionEvent::OutgoingConnectionError {