diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-07-25 20:17:33 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-07-25 20:17:33 +0200 |
commit | 16d0ccc48b2715a1b83d08c178af1d4d6647bd81 (patch) | |
tree | ba5ab7ee0b437fb379af76ddcd471b36db39f6ff | |
parent | 8a68b2355f0d1d1732875e04e9844cff7e7d8902 (diff) | |
download | libmicrohttpd-16d0ccc48b2715a1b83d08c178af1d4d6647bd81.tar.gz libmicrohttpd-16d0ccc48b2715a1b83d08c178af1d4d6647bd81.zip |
simplify
-rw-r--r-- | src/microhttpd/mhd_send.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c index 21e70bc2..49fd1edf 100644 --- a/src/microhttpd/mhd_send.c +++ b/src/microhttpd/mhd_send.c | |||
@@ -90,12 +90,20 @@ pre_cork_setsockopt (struct MHD_Connection *connection, | |||
90 | return 0; // return type error | 90 | return 0; // return type error |
91 | } | 91 | } |
92 | 92 | ||
93 | ret = -1; | ||
93 | #if TCP_CORK | 94 | #if TCP_CORK |
94 | ret = setsockopt (connection->socket_fd, | 95 | if (want_cork) |
95 | IPPROTO_TCP, | 96 | ret = setsockopt (connection->socket_fd, |
96 | TCP_CORK, | 97 | IPPROTO_TCP, |
97 | (const void *) &off_val, | 98 | TCP_CORK, |
98 | sizeof (off_val)); | 99 | (const void *) &on_val, |
100 | sizeof (on_val)); | ||
101 | else | ||
102 | ret = setsockopt (connection->socket_fd, | ||
103 | IPPROTO_TCP, | ||
104 | TCP_CORK, | ||
105 | (const void *) &off_val, | ||
106 | sizeof (off_val)); | ||
99 | #elif TCP_NODELAY | 107 | #elif TCP_NODELAY |
100 | ret = setsockopt (connection->socket_fd, | 108 | ret = setsockopt (connection->socket_fd, |
101 | IPPROTO_TCP, | 109 | IPPROTO_TCP, |
@@ -108,8 +116,6 @@ pre_cork_setsockopt (struct MHD_Connection *connection, | |||
108 | TCP_NOPUSH, | 116 | TCP_NOPUSH, |
109 | (const void *) &on_val, | 117 | (const void *) &on_val, |
110 | sizeof (on_val)); | 118 | sizeof (on_val)); |
111 | #else | ||
112 | ret = -1; | ||
113 | #endif | 119 | #endif |
114 | 120 | ||
115 | if (0 == ret) | 121 | if (0 == ret) |