[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 33/154: replace connection->send_cls()
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 33/154: replace connection->send_cls() |
Date: |
Mon, 19 Aug 2019 10:15:45 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository libmicrohttpd.
commit b854bbba20255f77a681a4020191dc8b42e23049
Author: ng0 <address@hidden>
AuthorDate: Fri Jul 19 20:39:19 2019 +0000
replace connection->send_cls()
---
src/microhttpd/connection.c | 58 +++++++++++++++++++++++++--------------------
src/microhttpd/mhd_send.c | 53 ++++++++++++++++++-----------------------
2 files changed, 55 insertions(+), 56 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 877f514b..4d93acee 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -53,7 +53,7 @@
/* For FreeBSD version identification */
#include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
-
+#include "mhd_send.h"
/**
* Message to transmit when http 1.1 request is received
@@ -3303,11 +3303,12 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
case MHD_CONNECTION_HEADERS_PROCESSED:
return;
case MHD_CONNECTION_CONTINUE_SENDING:
- ret = connection->send_cls (connection,
- &HTTP_100_CONTINUE
- [connection->continue_message_write_offset],
- MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE) -
- connection->continue_message_write_offset);
+ ret = MHD_send_on_connection_ (connection,
+ &HTTP_100_CONTINUE
+
[connection->continue_message_write_offset],
+ MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE) -
+ connection->continue_message_write_offset,
+ MHD_SSO_NO_CORK);
if (ret < 0)
{
if (MHD_ERR_AGAIN_ == ret)
@@ -3337,11 +3338,13 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
mhd_assert (0);
return;
case MHD_CONNECTION_HEADERS_SENDING:
- ret = connection->send_cls (connection,
- &connection->write_buffer
- [connection->write_buffer_send_offset],
- connection->write_buffer_append_offset -
- connection->write_buffer_send_offset);
+ /* TODO: Maybe use MHD_send_on_connection2_()? */
+ ret = MHD_send_on_connection_ (connection,
+ &connection->write_buffer
+ [connection->write_buffer_send_offset],
+ connection->write_buffer_append_offset -
+ connection->write_buffer_send_offset,
+ MHD_SSO_MAY_CORK);
if (ret < 0)
{
if (MHD_ERR_AGAIN_ == ret)
@@ -3389,11 +3392,12 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
- response->data_start;
if (data_write_offset > (uint64_t)SIZE_MAX)
MHD_PANIC (_("Data offset exceeds limit"));
- ret = connection->send_cls (connection,
- &response->data
- [(size_t)data_write_offset],
- response->data_size -
- (size_t)data_write_offset);
+ ret = MHD_send_on_connection_ (connection,
+ &response->data
+ [(size_t)data_write_offset],
+ response->data_size -
+ (size_t)data_write_offset,
+ MHD_SSO_NO_CORK);
#if DEBUG_SEND_DATA
if (ret > 0)
fprintf (stderr,
@@ -3432,11 +3436,12 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
mhd_assert (0);
return;
case MHD_CONNECTION_CHUNKED_BODY_READY:
- ret = connection->send_cls (connection,
- &connection->write_buffer
- [connection->write_buffer_send_offset],
- connection->write_buffer_append_offset -
- connection->write_buffer_send_offset);
+ ret = MHD_send_on_connection_ (connection,
+ &connection->write_buffer
+ [connection->write_buffer_send_offset],
+ connection->write_buffer_append_offset -
+ connection->write_buffer_send_offset,
+ MHD_SSO_NO_CORK);
if (ret < 0)
{
if (MHD_ERR_AGAIN_ == ret)
@@ -3460,11 +3465,12 @@ MHD_connection_handle_write (struct MHD_Connection
*connection)
mhd_assert (0);
return;
case MHD_CONNECTION_FOOTERS_SENDING:
- ret = connection->send_cls (connection,
- &connection->write_buffer
- [connection->write_buffer_send_offset],
- connection->write_buffer_append_offset -
- connection->write_buffer_send_offset);
+ ret = MHD_send_on_connection_ (connection,
+ &connection->write_buffer
+ [connection->write_buffer_send_offset],
+ connection->write_buffer_append_offset -
+ connection->write_buffer_send_offset,
+ MHD_SSO_HDR_CORK);
if (ret < 0)
{
if (MHD_ERR_AGAIN_ == ret)
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 18fa617f..36007929 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -24,37 +24,33 @@
* @author ng0 <address@hidden>
*/
-// to be used in: send_param_adapter, MHD_send_
-// and every place where sendfile(), sendfile64(), setsockopt()
-// are used.
-// TODO: sendfile() wrappers.
+/* TODO: sendfile() wrappers. */
#include "mhd_send.h"
-// NOTE: TCP_CORK == TCP_NOPUSH in FreeBSD.
-// TCP_CORK is Linux.
-// TCP_CORK/TCP_NOPUSH: don't send out partial frames.
-// TCP_NODELAY: disable Nagle (aggregate data based on
-// buffer pressur).
-// TODO: It is possible that Solaris/SunOS depending on
-// the linked library needs a different setsockopt usage:
-//
https://stackoverflow.com/questions/48670299/setsockopt-usage-in-linux-and-solaris-invalid-argument-in-solaris
-
/*
- *
https://svnweb.freebsd.org/base/head/sys/netinet/tcp_usrreq.c?view=markup&pathrev=346360
+ * NOTE:
+ * It might be possible that Solaris/SunOS depending on the linked library
needs a different setsockopt usage:
+ *
https://stackoverflow.com/questions/48670299/setsockopt-usage-in-linux-and-solaris-invalid-argument-in-solaris
+ *
* Approximately in 2007 work began to make TCP_NOPUSH in FreeBSD
* behave like TCP_CORK in Linux. Thus we define them to be one and
* the same, which again could be platform dependent (NetBSD does
* (so far) only provide a FreeBSD compatibility here, for example).
* Since we only deal with IPPROTO_TCP flags in this file and nowhere
* else, we don't have to move this elsewhere for now.
-*/
-/*
-#if ! defined(TCP_CORK) && defined(TCP_NOPUSH)
-#define TCP_CORK TCP_NOPUSH
-#endif
-*/
-/*
+ *
https://svnweb.freebsd.org/base/head/sys/netinet/tcp_usrreq.c?view=markup&pathrev=346360
+ *
+ * verbose notes, remove when done:
+ * TCP_CORK == TCP_NOPUSH in FreeBSD.
+ * TCP_CORK is Linux.
+ * TCP_CORK/TCP_NOPUSH: don't send out partial frames.
+ * TCP_NODELAY: disable Nagle (aggregate data based on buffer pressur)
+ *
+ * to be used in: send_param_adapter, MHD_send_
+ * and every place where sendfile(), sendfile64(), setsockopt() are used.
+ *
+ * Fix this up in doxygen style:
* -- OBJECTIVE:
* connection: use member 'socket', and remember the
* current state of the socket-options (cork/nocork/nodelay/whatever)
@@ -152,17 +148,14 @@ MHD_send_on_connection_ (struct MHD_Connection
*connection,
{
connection->sk_tcp_nodelay = true;
}
- //setsockopt (cork-on); // or nodelay on // + update
connection->sk_tcp_nodelay_on
- // When we have CORK, we can have NODELAY on the same system,
- // at least since Linux 2.2 and both can be combined since
- // Linux 2.5.71. See tcp(7). No other system in 2019-06 has TCP_CORK.
+ /* When we have CORK, we can have NODELAY on the same system,
+ * at least since Linux 2.2 and both can be combined since
+ * Linux 2.5.71. See tcp(7). No other system in 2019-06 has TCP_CORK. */
}
#elif TCP_NOPUSH
- /*
- * TCP_NOPUSH on FreeBSD is equal to cork on Linux, with the
- * exception that we know that TCP_NOPUSH will definitely
- * exist and we can disregard TCP_NODELAY unless requested.
- */
+ /* TCP_NOPUSH on FreeBSD is equal to cork on Linux, with the
+ * exception that we know that TCP_NOPUSH will definitely
+ * exist and we can disregard TCP_NODELAY unless requested. */
if ((use_corknopush) && (have_cork && ! want_cork))
{
if (0 == setsockopt (connection->socket_fd,
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [libmicrohttpd] 17/154: mhd_send: start adding logic from send_param_adapter., (continued)
- [GNUnet-SVN] [libmicrohttpd] 17/154: mhd_send: start adding logic from send_param_adapter., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 12/154: Add mhd_send to Makefile, more fixes in mhd_send., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 20/154: mhd_send.c: variable declarations (style)., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 19/154: adjust, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 11/154: restructure a bit to reuse existing send function, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 23/154: mhd_send: change send_tls_adapter() to non-static and export its prototype, use it in mhd_send.c, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 22/154: mhd_send.c: call send_tls_adapter() when TLS is used., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 24/154: move TLS branch to right position, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 37/154: flatten if statements, add initial TCP_NOPUSH to MHD_send_on_connection2_, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 39/154: indent, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 33/154: replace connection->send_cls(),
gnunet <=
- [GNUnet-SVN] [libmicrohttpd] 13/154: mhd_send.c: fix compiler error about MSG_MORE when MSG_MORE is undefined., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 18/154: more from connection.c, without checks so far., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 16/154: mhd_send: Use MHD_SCKT_OPT_BOOL_ for setsockopt optval., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 28/154: fixes, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 43/154: move comment above function., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 25/154: inline TLS logic, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 15/154: iAdd headerfile for mhd_send., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 26/154: indentation, comments, issue, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 29/154: fix err logic, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 10/154: mhd_send: Restructure., gnunet, 2019/08/19