Skip to main content

set_tcp_nodelay

Function set_tcp_nodelay 

Source
pub(crate) fn set_tcp_nodelay(tcp_stream: &TcpStream)
Expand description

Disables Nagle’s algorithm on a peer’s TCP connection.

Zebra writes each message to the socket in one flush, so this does not split messages into extra packets. But with Nagle’s algorithm, a small message sent straight after another small message waits until the peer acknowledges the first one, and peers can delay that acknowledgement for 40ms or more. For example, this happens to a response with a tx and a notfound message, or to a request sent right after an inv.

zcashd and Bitcoin Core also disable Nagle’s algorithm on their peer connections.