Set TCP_NODELAY for `WSLProxy` to disable Nagle for interactivity

GitOrigin-RevId: 60995cbab5ab04ec5c1da3904b7311ead1a52aaf
This commit is contained in:
Ilya.Kazakevich
2022-10-06 17:09:21 +02:00
committed by intellij-monorepo-bot
parent bd436696e5
commit e50e14ed8f
2 changed files with 7 additions and 0 deletions

Binary file not shown.

View File

@@ -7,6 +7,7 @@
#include <pthread.h>
#include <strings.h>
#include <errno.h>
#include <netinet/tcp.h>
// See svg file and wslproxy_test_client.py
@@ -56,6 +57,12 @@ static int jb_create_srv_socket(const in_addr_t listen_to, uint16_t *port) {
perror("can't open socket");
exit(-1);
}
// Ktor sets it to decrease delay, so do we
const int flags = 1;
if (setsockopt(sock, SOL_TCP, TCP_NODELAY, (void *) &flags, sizeof(flags)) != 0) {
perror("Can't set sock opt");
exit(-1);
}
struct sockaddr_in addr_p = {0};
addr_p.sin_family = AF_INET;
addr_p.sin_addr.s_addr = listen_to;