[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 73/154: Start reworking into generic setsoc
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 73/154: Start reworking into generic setsockopt wrapper. |
Date: |
Mon, 19 Aug 2019 10:16:25 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository libmicrohttpd.
commit e072dbba655ff8ee52ecd00631b4732334320c93
Author: ng0 <address@hidden>
AuthorDate: Wed Jul 24 15:49:59 2019 +0000
Start reworking into generic setsockopt wrapper.
---
src/microhttpd/mhd_send.c | 35 +++++++++++++++++++++++------------
src/microhttpd/mhd_send.h | 6 ++++++
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index b235c6ff..47ff09cc 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -63,8 +63,26 @@ MHD_send_socket_state_nodelay_ (struct MHD_Connection
*connection,
#endif
}
+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_NODELAY flag on socket and save the
+ * Set TCP_NOCORK or TCP_NODELAY flag on socket and save the
* #sk_tcp_nodelay_on state.
*
* @param connection the MHD_Connection structure
@@ -241,7 +259,7 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
#if TCP_NODELAY
if ((! using_tls) && (! use_corknopush) && (! have_cork && want_cork))
{
- MHD_send_socket_state_nodelay_ (connection, false);
+ MHD_setsockopt_ (connection, TCP_NODELAY, false, false);
}
#endif
@@ -348,7 +366,7 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
#if TCP_NODELAY
if ((! using_tls) && (! use_corknopush) && (have_cork && ! want_cork))
{
- MHD_send_socket_state_nodelay_ (connection, true);
+ MHD_setsockopt_ (connection, TCP_NODELAY, true, true);
}
#endif
@@ -401,7 +419,7 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
#if TCP_NODELAY
if ((! use_corknopush) && (! have_cork && want_cork))
{
- MHD_send_socket_state_nodelay_ (connection, false);
+ MHD_setsockopt_(connection, TCP_NODELAY, false, false);
}
#endif
@@ -429,14 +447,7 @@ MHD_send_on_connection2_ (struct MHD_Connection
*connection,
if ((ret == header_len + buffer_len) && have_cork)
{
// Response complete, definitely uncork!
- if (0 == setsockopt (s,
- IPPROTO_TCP,
- TCP_CORK,
- (const void *) &off_val,
- sizeof (off_val)))
- {
- connection->sk_tcp_nodelay_on = true;
- }
+ MHD_setsockopt_(connection, TCP_CORK, false, true);
}
errno = eno;
}
diff --git a/src/microhttpd/mhd_send.h b/src/microhttpd/mhd_send.h
index c01d9357..78edc9de 100644
--- a/src/microhttpd/mhd_send.h
+++ b/src/microhttpd/mhd_send.h
@@ -78,6 +78,12 @@ 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,
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [libmicrohttpd] 61/154: incomplete commit, adding 2 new helper functions and more., (continued)
- [GNUnet-SVN] [libmicrohttpd] 61/154: incomplete commit, adding 2 new helper functions and more., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 69/154: function replace., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 79/154: fix, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 82/154: revert last patch, should be only on master for now, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 67/154: remove commented code, replaced by functions., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 85/154: pre_cork socket.., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 72/154: first attempt to add MHD_send_on_connection2_, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 66/154: doxygen., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 70/154: conditionally return and setsockopt., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 74/154: fix failure to build., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 73/154: Start reworking into generic setsockopt wrapper.,
gnunet <=
- [GNUnet-SVN] [libmicrohttpd] 84/154: Merge branch 'dev/ng0/gsoc2019' of gnunet.org:libmicrohttpd into dev/ng0/gsoc2019, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 77/154: fix, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 78/154: buffersize, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 90/154: show not tell, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 81/154: Merge branch 'dev/ng0/gsoc2019' of git+ssh://gnunet.org/libmicrohttpd into dev/ng0/gsoc2019, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 83/154: post_cork function first draft, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 63/154: attempt fix., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 80/154: fix regression introduced in cc5032b85, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 92/154: simplify, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 103/154: test, gnunet, 2019/08/19