Skip to content

Commit 4157140

Browse files
committed
set tcp nodelay on all accepted connections
1 parent fb06db6 commit 4157140

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/core/connection.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ static void* connection_handle_accept(void *arg)
385385
uint64_t u = 1;
386386
listener_type our_type = thread_arg->type;
387387
int eventfd = thread_arg->eventfd;
388+
int enable = 1;
388389

389390
for (uint32_t i = 0; i < scache_listeners.listener_count; i++)
390391
{
@@ -425,6 +426,10 @@ static void* connection_handle_accept(void *arg)
425426
DEBUG("[#] Accepting connection from fd %d of type %s\n", fd, listener_type_string(our_type));
426427
int client_sock = accept(fd, NULL, NULL);
427428

429+
if(-1 == setsockopt(client_sock, IPPROTO_TCP, TCP_NODELAY, (const char*)&enable, sizeof(enable))){
430+
DEBUG("[#] Unable to set tcp nodelay\n");
431+
}
432+
428433
if (client_sock < 0) {
429434
if (errno != EAGAIN && errno != EWOULDBLOCK)
430435
{

0 commit comments

Comments
 (0)