Merge branch 'xMAC94x/tcp_buffer' into 'master'

increase the TCP Recv Buffer

See merge request veloren/veloren!4013
This commit is contained in:
Marcel 2023-07-06 10:45:17 +00:00
commit 34ffad71df

View File

@ -122,6 +122,14 @@ impl Protocols {
// See https://docs.rs/tokio/latest/tokio/net/struct.TcpSocket.html
#[cfg(not(windows))]
socket2_socket.set_reuse_address(true)?;
const SEND_BUFFER_SIZE: usize = 262144;
const RECV_BUFFER_SIZE: usize = SEND_BUFFER_SIZE * 2;
if let Err(e) = socket2_socket.set_recv_buffer_size(RECV_BUFFER_SIZE) {
warn!(?e, "Couldn't set recv_buffer size")
};
if let Err(e) = socket2_socket.set_send_buffer_size(SEND_BUFFER_SIZE) {
warn!(?e, "Couldn't set set_buffer size")
};
let socket2_addr = addr.into();
socket2_socket.bind(&socket2_addr)?;
socket2_socket.listen(1024)?;