libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit be86a916eb5e23d3d636f79e1a95a71f86d7610d
parent 9e8418b943c417b50b0e7ecac868cde3933aba5e
Author: ng0 <ng0@n0.is>
Date:   Mon, 29 Jul 2019 15:10:37 +0000

switch post/pre function definition to a logical appearance in the file
(pre before post), purely for orientation.

Diffstat:
Msrc/microhttpd/mhd_send.c | 48++++++++++++++++++++++++------------------------
1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c @@ -43,8 +43,8 @@ * @param want_cork cork state, boolean */ static void -post_cork_setsockopt (struct MHD_Connection *connection, - bool want_cork) +pre_cork_setsockopt (struct MHD_Connection *connection, + bool want_cork) { #ifndef MSG_MORE int ret; @@ -57,29 +57,35 @@ post_cork_setsockopt (struct MHD_Connection *connection, /* nothing to do, success! */ return; } + ret = -1; #if TCP_CORK - if (! want_cork) + if (want_cork) ret = setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_CORK, - &off_val, - sizeof (off_val)); + (const void *) &on_val, + sizeof (on_val)); #elif TCP_NODELAY - /* nothing to do */ + ret = setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NODELAY, + (const void *) want_cork ? &off_val : &on_val, + sizeof (on_val)); #elif TCP_NOPUSH ret = setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_NOPUSH, - (const void *) &off_val, - sizeof (off_val)); + (const void *) &on_val, + sizeof (on_val)); #endif + if (0 == ret) { connection->sk_cork_on = want_cork; } return; -#endif /* HAVE_MORE */ +#endif /* MSG_MORE */ } /** @@ -89,8 +95,8 @@ post_cork_setsockopt (struct MHD_Connection *connection, * @param want_cork cork state, boolean */ static void -pre_cork_setsockopt (struct MHD_Connection *connection, - bool want_cork) +post_cork_setsockopt (struct MHD_Connection *connection, + bool want_cork) { #ifndef MSG_MORE int ret; @@ -103,35 +109,29 @@ pre_cork_setsockopt (struct MHD_Connection *connection, /* nothing to do, success! */ return; } - ret = -1; #if TCP_CORK - if (want_cork) + if (! want_cork) ret = setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_CORK, - (const void *) &on_val, - sizeof (on_val)); + &off_val, + sizeof (off_val)); #elif TCP_NODELAY - ret = setsockopt (connection->socket_fd, - IPPROTO_TCP, - TCP_NODELAY, - (const void *) want_cork ? &off_val : &on_val, - sizeof (on_val)); + /* nothing to do */ #elif TCP_NOPUSH ret = setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_NOPUSH, - (const void *) &on_val, - sizeof (on_val)); + (const void *) &off_val, + sizeof (off_val)); #endif - if (0 == ret) { connection->sk_cork_on = want_cork; } return; -#endif /* MSG_MORE */ +#endif /* HAVE_MORE */ } /**