Adding TCP no delay

This commit is contained in:
WolverinDEV 2020-08-01 12:24:59 +02:00
parent f14e5e0148
commit 97cf371362
1 changed files with 4 additions and 0 deletions

View File

@ -508,6 +508,10 @@ void LocalFileTransfer::callback_transfer_network_accept(int fd, short, void *pt
return;
}
int enabled = 1;
if(setsockopt(client_fd, IPPROTO_TCP, TCP_NODELAY, &enabled, sizeof enabled) < 0)
logError(LOG_FT, "Cant enable TCP no delay for socket {}. Error: {}/{}", client_fd, errno, strerror(errno));
auto client = std::make_shared<FileClient>(transfer);
memcpy(&client->networking.address, &address, sizeof(sockaddr_storage));