aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_send.c
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-07-29 15:10:37 +0000
committerng0 <ng0@n0.is>2019-07-29 15:10:37 +0000
commitbe86a916eb5e23d3d636f79e1a95a71f86d7610d (patch)
tree3c765d37a44bfccaba04b98213c4e7ecac206b55 /src/microhttpd/mhd_send.c
parent9e8418b943c417b50b0e7ecac868cde3933aba5e (diff)
downloadlibmicrohttpd-be86a916eb5e23d3d636f79e1a95a71f86d7610d.tar.gz
libmicrohttpd-be86a916eb5e23d3d636f79e1a95a71f86d7610d.zip
switch post/pre function definition to a logical appearance in the file
(pre before post), purely for orientation.
Diffstat (limited to 'src/microhttpd/mhd_send.c')
-rw-r--r--src/microhttpd/mhd_send.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index be136c23..442a5373 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -43,8 +43,8 @@
43 * @param want_cork cork state, boolean 43 * @param want_cork cork state, boolean
44 */ 44 */
45static void 45static void
46post_cork_setsockopt (struct MHD_Connection *connection, 46pre_cork_setsockopt (struct MHD_Connection *connection,
47 bool want_cork) 47 bool want_cork)
48{ 48{
49#ifndef MSG_MORE 49#ifndef MSG_MORE
50 int ret; 50 int ret;
@@ -57,29 +57,35 @@ post_cork_setsockopt (struct MHD_Connection *connection,
57 /* nothing to do, success! */ 57 /* nothing to do, success! */
58 return; 58 return;
59 } 59 }
60
60 ret = -1; 61 ret = -1;
61#if TCP_CORK 62#if TCP_CORK
62 if (! want_cork) 63 if (want_cork)
63 ret = setsockopt (connection->socket_fd, 64 ret = setsockopt (connection->socket_fd,
64 IPPROTO_TCP, 65 IPPROTO_TCP,
65 TCP_CORK, 66 TCP_CORK,
66 &off_val, 67 (const void *) &on_val,
67 sizeof (off_val)); 68 sizeof (on_val));
68#elif TCP_NODELAY 69#elif TCP_NODELAY
69 /* nothing to do */ 70 ret = setsockopt (connection->socket_fd,
71 IPPROTO_TCP,
72 TCP_NODELAY,
73 (const void *) want_cork ? &off_val : &on_val,
74 sizeof (on_val));
70#elif TCP_NOPUSH 75#elif TCP_NOPUSH
71 ret = setsockopt (connection->socket_fd, 76 ret = setsockopt (connection->socket_fd,
72 IPPROTO_TCP, 77 IPPROTO_TCP,
73 TCP_NOPUSH, 78 TCP_NOPUSH,
74 (const void *) &off_val, 79 (const void *) &on_val,
75 sizeof (off_val)); 80 sizeof (on_val));
76#endif 81#endif
82
77 if (0 == ret) 83 if (0 == ret)
78 { 84 {
79 connection->sk_cork_on = want_cork; 85 connection->sk_cork_on = want_cork;
80 } 86 }
81 return; 87 return;
82#endif /* HAVE_MORE */ 88#endif /* MSG_MORE */
83} 89}
84 90
85/** 91/**
@@ -89,8 +95,8 @@ post_cork_setsockopt (struct MHD_Connection *connection,
89 * @param want_cork cork state, boolean 95 * @param want_cork cork state, boolean
90 */ 96 */
91static void 97static void
92pre_cork_setsockopt (struct MHD_Connection *connection, 98post_cork_setsockopt (struct MHD_Connection *connection,
93 bool want_cork) 99 bool want_cork)
94{ 100{
95#ifndef MSG_MORE 101#ifndef MSG_MORE
96 int ret; 102 int ret;
@@ -103,35 +109,29 @@ pre_cork_setsockopt (struct MHD_Connection *connection,
103 /* nothing to do, success! */ 109 /* nothing to do, success! */
104 return; 110 return;
105 } 111 }
106
107 ret = -1; 112 ret = -1;
108#if TCP_CORK 113#if TCP_CORK
109 if (want_cork) 114 if (! want_cork)
110 ret = setsockopt (connection->socket_fd, 115 ret = setsockopt (connection->socket_fd,
111 IPPROTO_TCP, 116 IPPROTO_TCP,
112 TCP_CORK, 117 TCP_CORK,
113 (const void *) &on_val, 118 &off_val,
114 sizeof (on_val)); 119 sizeof (off_val));
115#elif TCP_NODELAY 120#elif TCP_NODELAY
116 ret = setsockopt (connection->socket_fd, 121 /* nothing to do */
117 IPPROTO_TCP,
118 TCP_NODELAY,
119 (const void *) want_cork ? &off_val : &on_val,
120 sizeof (on_val));
121#elif TCP_NOPUSH 122#elif TCP_NOPUSH
122 ret = setsockopt (connection->socket_fd, 123 ret = setsockopt (connection->socket_fd,
123 IPPROTO_TCP, 124 IPPROTO_TCP,
124 TCP_NOPUSH, 125 TCP_NOPUSH,
125 (const void *) &on_val, 126 (const void *) &off_val,
126 sizeof (on_val)); 127 sizeof (off_val));
127#endif 128#endif
128
129 if (0 == ret) 129 if (0 == ret)
130 { 130 {
131 connection->sk_cork_on = want_cork; 131 connection->sk_cork_on = want_cork;
132 } 132 }
133 return; 133 return;
134#endif /* MSG_MORE */ 134#endif /* HAVE_MORE */
135} 135}
136 136
137/** 137/**