Skip to content

Commit

Permalink
Condition linux TCP keepalive sockopts
Browse files Browse the repository at this point in the history
It's specific for Linux, so condition it on __linux__
  • Loading branch information
plajjan committed Feb 11, 2024
1 parent de411b0 commit 6e20501
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tlsuv.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ int tlsuv_stream_keepalive(tlsuv_stream_t *clt, int keepalive, unsigned int dela
#if defined(TCP_KEEPALIVE)
setsockopt(s, IPPROTO_TCP, TCP_KEEPALIVE, &delay, sizeof(delay));
#endif
#if __linux__
setsockopt(s, IPPROTO_TCP, TCP_KEEPINTVL, &intvl, sizeof(intvl));
setsockopt(s, IPPROTO_TCP, TCP_KEEPCNT, &count, sizeof(count));
#endif
}
return 0;
}
Expand Down

0 comments on commit 6e20501

Please sign in to comment.