[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 21/154: mhd_send.c: Use daemon from connect
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 21/154: mhd_send.c: Use daemon from connection struct. |
Date: |
Mon, 19 Aug 2019 10:15:33 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository libmicrohttpd.
commit 843b844d64578aa20749658c656d93ea2e17710c
Author: ng0 <address@hidden>
AuthorDate: Thu Jul 18 16:18:30 2019 +0000
mhd_send.c: Use daemon from connection struct.
---
src/microhttpd/mhd_send.c | 83 ++++++++++++++++++++++++-----------------------
1 file changed, 43 insertions(+), 40 deletions(-)
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index c6218870..d32533a8 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -90,13 +90,13 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
const MHD_SCKT_OPT_BOOL_ on_val = 1;
const int err = MHD_socket_get_error_ ();
- // error handling from send_param_adapter()
+ /* error handling from send_param_adapter() */
if ((MHD_INVALID_SOCKET == s) || (MHD_CONNECTION_CLOSED ==
connection->state))
{
return MHD_ERR_NOTCONN_;
}
- // from send_param_adapter()
+ /* from send_param_adapter() */
if (buffer_size > MHD_SCKT_SEND_MAX_SIZE_)
buffer_size = MHD_SCKT_SEND_MAX_SIZE_; /* return value limit */
@@ -142,17 +142,18 @@ MHD_send_on_connection_ (struct MHD_Connection
*connection,
{
if (have_cork && ! want_cork)
{
- setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- TCP_CORK,
- (const void *) &on_val,
- sizeof (on_val)) ||
- (setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- TCP_NODELAY,
- (const void *) &on_val,
- sizeof (on_val)) &&
- (connection->sk_tcp_nodelay = true));
+ if (0 == setsockopt (connection->socket_fd,
+ IPPROTO_TCP,
+ TCP_CORK,
+ (const void *) &on_val,
+ sizeof (on_val)))
+ else if (0 == setsockopt (connection->socket_fd,
+ IPPROTO_TCP,
+ TCP_NODELAY,
+ (const void *) &on_val,
+ sizeof (on_val))) {
+ 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
@@ -215,12 +216,11 @@ MHD_send_on_connection_ (struct MHD_Connection
*connection,
*/
/* for TLS*/
- /*
- if (0 != (daemon->options & MHD_USE_TLS))
- TLS;
+
+ if (0 != (connection->daemon->options & MHD_USE_TLS))
+ /* old TLS code here */;
else
no-TLS;
- */
// shouldn't we return 0 or -1? Why re-use the _ERR_ functions?
// error handling from send_param_adapter():
@@ -256,17 +256,18 @@ MHD_send_on_connection_ (struct MHD_Connection
*connection,
if (! have_cork && want_cork && ! have_more)
{
//setsockopt (cork-off); // or nodelay off // + update
connection->sk_tcp_nodelay_on
- setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- TCP_CORK,
- (const void *) &off_val,
- sizeof (off_val)) ||
- (setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- TCP_NODELAY,
- (const void *) &off_val,
- sizeof (off_val)) &&
- (connection->sk_tcp_nodelay_on = false));
+ if (0 == setsockopt (connection->socket_fd,
+ IPPROTO_TCP,
+ TCP_CORK,
+ (const void *) &off_val,
+ sizeof (off_val)))
+ else if (0 == setsockopt (connection->socket_fd,
+ IPPROTO_TCP,
+ TCP_NODELAY,
+ (const void *) &off_val,
+ sizeof (off_val))) {
+ connection->sk_tcp_nodelay_on = false;
+ }
}
}
#elif TCP_NOPUSH
@@ -283,12 +284,13 @@ MHD_send_on_connection_ (struct MHD_Connection
*connection,
if (have_cork && ! want_cork)
{
// setsockopt (nodelay - on);
- setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- TCP_NODELAY,
- (const void *) &on_val,
- sizeof (on_val)) &&
- (connection->sk_tcp_nodelay_on = true);
+ if (0 == setsockopt (connection->socket_fd,
+ IPPROTO_TCP,
+ TCP_NODELAY,
+ (const void *) &on_val,
+ sizeof (on_val))) {
+ connection->sk_tcp_nodelay_on = true;
+ }
}
// ...
}
@@ -337,12 +339,13 @@ MHD_send_on_connection2_ (struct MHD_Connection
*connection,
if (! have_cork && want_cork)
{
// setsockopt (nodelay-off);
- setsockopt (connection->socket_fd,
- IPPROTO_TCP,
- TCP_NODELAY,
- (const void *) &off_val,
- sizeof (off_val)) &&
- (connection->sk_tcp_nodelay = false);
+ if (0 == setsockopt (connection->socket_fd,
+ IPPROTO_TCP,
+ TCP_NODELAY,
+ (const void *) &off_val,
+ sizeof (off_val))) {
+ connection->sk_tcp_nodelay = false;
+ }
}
// ...
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [libmicrohttpd] 16/154: mhd_send: Use MHD_SCKT_OPT_BOOL_ for setsockopt optval., (continued)
- [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
- [GNUnet-SVN] [libmicrohttpd] 27/154: fixes, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 32/154: setsockopt(): check return value., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 21/154: mhd_send.c: Use daemon from connection struct.,
gnunet <=
- [GNUnet-SVN] [libmicrohttpd] 45/154: fix compiler error., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 44/154: remove verbose comments in mhd_send.c, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 55/154: doxygen: MHD_SSO, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 30/154: comments, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 49/154: more OLDSOCK., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 59/154: sendfile and netbsd, comment., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 31/154: combine ifs, fix uninitialized var error, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 62/154: fix errors., gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 35/154: use using_tls, gnunet, 2019/08/19
- [GNUnet-SVN] [libmicrohttpd] 36/154: implement TCP_NOPUSH branch content, gnunet, 2019/08/19