[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 99/154: remove dead code, comment new code.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 99/154: remove dead code, comment new code. |
Date: |
Mon, 19 Aug 2019 10:16:51 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository libmicrohttpd.
commit b76dadc0fda1ea9565211093db8a9021a41361e8
Author: ng0 <address@hidden>
AuthorDate: Thu Jul 25 19:06:13 2019 +0000
remove dead code, comment new code.
---
src/microhttpd/mhd_send.c | 207 ++++------------------------------------------
src/microhttpd/mhd_send.h | 22 -----
2 files changed, 17 insertions(+), 212 deletions(-)
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index ee627e10..513b7dfb 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -24,8 +24,6 @@
* @author ng0 <address@hidden>
*/
-/* TODO: sendfile() wrapper, in connection.c */
-
/* Worth considering for future improvements and additions:
* NetBSD has no sendfile or sendfile64. The way to work
* with this seems to be to mmap the file and write(2) as
@@ -38,7 +36,13 @@
#include "mhd_send.h"
-int
+/**
+ * Handle setsockopt calls.
+ *
+ * @param connection the MHD_Connection structure
+ * @param want_cork cork state, boolean
+ */
+static void
post_cork_setsockopt (struct MHD_Connection *connection,
bool want_cork)
{
@@ -50,7 +54,7 @@ post_cork_setsockopt (struct MHD_Connection *connection,
if (connection->sk_cork_on == want_cork)
{
/* nothing to do, success! */
- return 0;
+ return;
}
ret = -1;
#if TCP_CORK
@@ -76,20 +80,25 @@ post_cork_setsockopt (struct MHD_Connection *connection,
return ret;
}
-int
+/**
+ * Handle setsockopt calls.
+ *
+ * @param connection the MHD_Connection structure
+ * @param want_cork cork state, boolean
+ */
+static void
pre_cork_setsockopt (struct MHD_Connection *connection,
bool want_cork)
{
int ret;
- // const MHD_SCKT_OPT_BOOL_ state_val = val ? 1 : 0;
const MHD_SCKT_OPT_BOOL_ off_val = 0;
const MHD_SCKT_OPT_BOOL_ on_val = 1;
- // if sk_tcp_nodelay_on is already what we pass in, return.
+ /* if sk_tcp_nodelay_on is already what we pass in, return. */
if (connection->sk_cork_on == want_cork)
{
/* nothing to do, success! */
- return 0;
+ return;
}
ret = -1;
@@ -121,188 +130,6 @@ pre_cork_setsockopt (struct MHD_Connection *connection,
return ret;
}
-/**
- * Set TCP_NODELAY flag on socket and save the
- * #sk_tcp_nodelay_on state.
- *
- * @param connection the MHD_Connection structure
- * @param value the state to set, boolean
- */
-void
-MHD_send_socket_state_nodelay_ (struct MHD_Connection *connection,
- bool value)
-{
-#if TCP_NODELAY
- const MHD_SCKT_OPT_BOOL_ state_val = value ? 1 : 0;
-
- if (0 == setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- TCP_NODELAY,
- (const void *) &state_val,
- sizeof (state_val)))
- {
- connection->sk_tcp_nodelay_on = value;
- }
-#endif
-}
-
-/*
-void
-MHD_setsockopt_pre_ (struct MHD_Connection *connection,
- bool value)
-{
- bool using_tls = false;
-#ifdef HTTPS_SUPPORT
- using_tls = (0 != (connection->daemon->options & MHD_USE_TLS));
-#endif
- const MHD_SCKT_OPT_BOOL_ state_val = value ? 1 : 0;
- const MHD_SCKT_OPT_BOOL_ off_val = 0;
- const MHD_SCKT_OPT_BOOL_ on_val = 1;
-
- if (connection->sk_tcp_nodelay_on == value)
- {
- return
- }
- if (0 == setsockopt (connection->socket_fd,
- IPPROTO_TCP,
-#if TCP_CORK && (! using_tls)
- TCP_CORK,
- (const void *) &off_val,
- sizeof (off_val)))
- {
- connection->sk_tcp_nodelay_on = on_val;
- }
-#elif TCP_NODELAY
- TCP_NODELAY,
- (const void *) &off_val,
- sizeof (off_val)))
-#endif
-#if TCP_NOPUSH
-#endif
- (const void *) &state_val,
- sizeof (state_val)))
-}
-*/
-/*
-void
-MHD_setsockopt_post_ (struct MHD_Connection *connection,
- bool value)
-{
- if (connection->sk_tcp_nodelay_on == value)
- {
- return
- }
- if (0 == setsockopt (connection->socket_fd,
- IPPROTO_TCP,
-#if TCP_NODELAY
- TCP_NODELAY,
-#endif
-#if TCP_NOPUSH
- TCP_NOPUSH,
-#endif
-#if TCP_CORK
- TCP_CORK,
-#endif
-
-
- (const void *) &state_val,
- sizeof (state_val)))
- {
- // When TRUE above, this is usually FALSE, but
- // not always. We can't use the negation of
- // value for that reason.
- connection->sk_tcp_nodelay_on = state_store;
- }
-}
-*/
-void
-MHD_setsockopt_ (struct MHD_Connection *connection,
- int optname,
- bool value,
- bool state_store)
-{
- const MHD_SCKT_OPT_BOOL_ state_val = value ? 1 : 0;
-
- if (0 == setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- optname,
- (const void *) &state_val,
- sizeof (state_val)))
- {
- connection->sk_tcp_nodelay_on = state_store;
- }
-}
-
-/**
- * Set TCP_NOCORK or TCP_NODELAY flag on socket and save the
- * #sk_tcp_nodelay_on state.
- *
- * @param connection the MHD_Connection structure
- * @param cork_value the state to set, boolean
- * @param cork_state the boolean value passed to #sk_tcp_nodelay_on
- * @param nodelay_value the state to set, boolean
- * @param nodelay_state the boolean value passed to #sk_tcp_nodelay_on
- */
-void
-MHD_send_socket_state_cork_nodelay_ (struct MHD_Connection *connection,
- bool cork_value,
- bool cork_state,
- bool nodelay_value,
- bool nodelay_state)
-{
-#if TCP_CORK && TCP_NODELAY
- const MHD_SCKT_OPT_BOOL_ cork_state_val = cork_value ? 1 : 0;
- const MHD_SCKT_OPT_BOOL_ nodelay_state_val = nodelay_value ? 1 : 0;
-
- if (0 == setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- TCP_CORK,
- (const void *) &cork_state_val,
- sizeof (cork_state_val)))
- {
- connection->sk_tcp_nodelay_on = cork_state;
- }
- else if (0 == setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- TCP_NODELAY,
- (const void *) &nodelay_state_val,
- sizeof (nodelay_state_val)))
- {
- connection->sk_tcp_nodelay_on = nodelay_state;
- }
-#endif
-}
-
-/**
- * Set TCP_NOPUSH flag on socket and save the
- * #sk_tcp_nodelay_on state.
- *
- * @param connection the #MHD_Connection structure
- * @param value the state to set, boolean
- * @param state_store the boolean value passed to #sk_tcp_nodelay_on
- */
-void
-MHD_send_socket_state_nopush_ (struct MHD_Connection *connection,
- bool value,
- bool state_store)
-{
-#if TCP_NOPUSH
- const MHD_SCKT_OPT_BOOL_ state_val = value ? 1 : 0;
-
- if (0 == setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- TCP_NOPUSH,
- (const void *) &state_val,
- sizeof (state_val)))
- {
- /* When TRUE above, this is usually FALSE, but
- * not always. We can't use the negation of
- * value for that reason. */
- connection->sk_tcp_nodelay_on = state_store;
- }
-#endif
-}
-
/**
* Send buffer on connection, and remember the current state of
* the socket options; only call setsockopt when absolutely
diff --git a/src/microhttpd/mhd_send.h b/src/microhttpd/mhd_send.h
index e94ed509..5f0f8155 100644
--- a/src/microhttpd/mhd_send.h
+++ b/src/microhttpd/mhd_send.h
@@ -92,28 +92,6 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
ssize_t
MHD_sendfile_on_connection_ (struct MHD_Connection *connection);
-void
-MHD_setsockopt_ (struct MHD_Connection *connection,
- int optname,
- bool value,
- bool state_store);
-
-void
-MHD_send_socket_state_nopush_ (struct MHD_Connection *connection,
- bool value,
- bool state_store);
-
-void
-MHD_send_socket_state_nodelay_ (struct MHD_Connection *connection,
- bool value);
-
-void
-MHD_send_socket_state_cork_nodelay_ (struct MHD_Connection *connection,
- bool cork_value,
- bool cork_state,
- bool nodelay_value,
- bool nodelay_state);
-
#if defined(_MHD_HAVE_SENDFILE)
ssize_t
sendfile_adapter (struct MHD_Connection *connection);
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [libmicrohttpd] 94/154: simplify, (continued)
- [GNUnet-SVN] [libmicrohttpd] 94/154: simplify, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 89/154: attempt fix, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 97/154: simplify, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 108/154: have_cork->want_cork, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 91/154: show not tell, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 102/154: for tests, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 86/154: initial move code sendfile., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 100/154: incomplete, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 111/154: synt, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 105/154: remove commented code, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 99/154: remove dead code, comment new code.,
gnunet <=
- [GNUnet-SVN] [libmicrohttpd] 109/154: declare ret, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 120/154: configure, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 119/154: attempt configure fix, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 116/154: ack other authors, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 98/154: simplify, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 104/154: skcork, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 124/154: mhd_send commented,, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 127/154: remove commentblock, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 112/154: configure.ac: define a check for HAVE_SENDMSG, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 121/154: MSG_MORE fix, gnunet, 2019/08/19