Skip to content

Commit

Permalink
Merge pull request #122 from shanth96/nodelay
Browse files Browse the repository at this point in the history
Set TCP_NODELAY
  • Loading branch information
jhawthorn committed Sep 14, 2023
2 parents fe52d3b + b0b061e commit 1f86ce1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ static int raw_connect_internal(struct trilogy_sock *sock, const struct addrinfo
return TRILOGY_SYSERR;
}

#ifdef TCP_NODELAY
if (sock->addr->ai_family != PF_UNIX) {
int flags = 1;
if (setsockopt(sock->fd, IPPROTO_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags)) < 0) {
goto fail;
}
}
#endif
if (sock->base.opts.keepalive_enabled) {
int flags = 1;
if (setsockopt(sock->fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags, sizeof(flags)) < 0) {
Expand Down

0 comments on commit 1f86ce1

Please sign in to comment.