From e2fdb74893ed04cae058956e52cdddb251e1fe0d Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Mon, 17 Jun 2019 07:26:59 +0300 Subject: [PATCH] Add TCP_NODELAY --- components/net/cpp/src/peer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/net/cpp/src/peer.cpp b/components/net/cpp/src/peer.cpp index 853b91d26..5e301ea84 100644 --- a/components/net/cpp/src/peer.cpp +++ b/components/net/cpp/src/peer.cpp @@ -83,6 +83,9 @@ static SOCKET tcpConnect(URI &uri) { return INVALID_SOCKET; } + int flags =1; + if (setsockopt(csocket, IPPROTO_TCP, TCP_NODELAY, (const char *)&flags, sizeof(flags))) { LOG(ERROR) << "ERROR: setsocketopt(), TCP_NODELAY"; }; + addrinfo hints = {}, *addrs; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; @@ -163,6 +166,9 @@ Peer::Peer(SOCKET s, Universe *u, Dispatcher *d) : sock_(s), can_reconnect_(fals is_waiting_ = true; scheme_ = ftl::URI::SCHEME_TCP; + + int flags =1; + if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (const char *)&flags, sizeof(flags))) { LOG(ERROR) << "ERROR: setsocketopt(), TCP_NODELAY"; }; // Send the initiating handshake if valid if (status_ == kConnecting) { -- GitLab