Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Setting TCP_NODELAY on outbound connections
Browse files Browse the repository at this point in the history
  • Loading branch information
jrepp authored and alkurbatov committed Aug 6, 2022
1 parent 1fb204e commit 44b561e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/civetweb.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
#pragma warning(disable : 4306)
/* conditional expression is constant: introduced by FD_SET(..) */
#pragma warning(disable : 4127)
/* expression before comma has no effect; expected expression with side-effect: introduced by FD_SET in VC2017 */
#pragma warning(disable : 4548)
/* non-constant aggregate initializer: issued due to missing C99 support */
#pragma warning(disable : 4204)
/* padding added after data member */
Expand Down Expand Up @@ -9407,6 +9409,13 @@ connect_socket(
return 0;
}

int nodelay_on = 1;
setsockopt(*sock,
IPPROTO_TCP,
TCP_NODELAY,
(SOCK_OPT_TYPE)&nodelay_on,
sizeof(nodelay_on));

set_close_on_exec(*sock, NULL, ctx);

if (ip_ver == 4) {
Expand Down

0 comments on commit 44b561e

Please sign in to comment.