mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Enable TCP_NODELAY.
This commit is contained in:
@ -75,6 +75,10 @@ impl Protocols {
|
|||||||
) -> Result<Self, NetworkConnectError> {
|
) -> Result<Self, NetworkConnectError> {
|
||||||
let stream = net::TcpStream::connect(addr)
|
let stream = net::TcpStream::connect(addr)
|
||||||
.await
|
.await
|
||||||
|
.and_then(|s| {
|
||||||
|
s.set_nodelay(true)?;
|
||||||
|
Ok(s)
|
||||||
|
})
|
||||||
.map_err(NetworkConnectError::Io)?;
|
.map_err(NetworkConnectError::Io)?;
|
||||||
info!(
|
info!(
|
||||||
"Connecting Tcp to: {}",
|
"Connecting Tcp to: {}",
|
||||||
@ -105,6 +109,12 @@ impl Protocols {
|
|||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
if let Err(e) = stream.set_nodelay(true) {
|
||||||
|
warn!(
|
||||||
|
?e,
|
||||||
|
"Failed to set TCP_NODELAY, client may have degraded latency"
|
||||||
|
);
|
||||||
|
}
|
||||||
let cid = cids.fetch_add(1, Ordering::Relaxed);
|
let cid = cids.fetch_add(1, Ordering::Relaxed);
|
||||||
info!(?remote_addr, ?cid, "Accepting Tcp from");
|
info!(?remote_addr, ?cid, "Accepting Tcp from");
|
||||||
let metrics = ProtocolMetricCache::new(&cid.to_string(), Arc::clone(&metrics));
|
let metrics = ProtocolMetricCache::new(&cid.to_string(), Arc::clone(&metrics));
|
||||||
|
Reference in New Issue
Block a user