gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libmicrohttpd] 02/02: Removed MHD_tls_connection_handle_id


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 02/02: Removed MHD_tls_connection_handle_idle() and MHD_Connection::idle_handler. Ensure that MHD_connection_update_event_loop_info() is called for MHD_TLS_CONNECTION_INIT state to properly update read/write event loop info when doing TLS handshake
Date: Mon, 29 May 2017 20:41:25 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit a21ff8a9eff8022ea0c4b73a7b636af10adee0eb
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Mon May 29 21:41:06 2017 +0300

    Removed MHD_tls_connection_handle_idle() and MHD_Connection::idle_handler.
    Ensure that MHD_connection_update_event_loop_info() is called for 
MHD_TLS_CONNECTION_INIT state to
    properly update read/write event loop info when doing TLS handshake
---
 src/microhttpd/connection.c       |  5 +++-
 src/microhttpd/connection_https.c | 48 ---------------------------------------
 src/microhttpd/daemon.c           | 26 ++++++++++-----------
 src/microhttpd/internal.h         |  6 -----
 4 files changed, 17 insertions(+), 68 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 1be9d4fd..915d3e1d 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2910,6 +2910,10 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
 #endif
       switch (connection->state)
         {
+#ifdef HTTPS_SUPPORT
+        case MHD_TLS_CONNECTION_INIT:
+          break;
+#endif /* HTTPS_SUPPORT */
         case MHD_CONNECTION_INIT:
           line = get_next_header_line (connection,
                                        &line_len);
@@ -3441,7 +3445,6 @@ MHD_set_http_callbacks_ (struct MHD_Connection 
*connection)
 {
   connection->read_handler = &MHD_connection_handle_read;
   connection->write_handler = &MHD_connection_handle_write;
-  connection->idle_handler = &MHD_connection_handle_idle;
 }
 
 
diff --git a/src/microhttpd/connection_https.c 
b/src/microhttpd/connection_https.c
index 9b441a9a..28f019a5 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -120,53 +120,6 @@ MHD_tls_connection_handle_write (struct MHD_Connection 
*connection)
 
 
 /**
- * This function was created to handle per-connection processing that
- * has to happen even if the socket cannot be read or written to.  All
- * implementations (multithreaded, external select, internal select)
- * call this function.
- *
- * @param connection being handled
- * @return #MHD_YES if we should continue to process the
- *         connection (not dead yet), #MHD_NO if it died
- */
-static int
-MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
-{
-  time_t timeout;
-
-#if DEBUG_STATES
-  MHD_DLOG (connection->daemon,
-            _("In function %s handling connection at state: %s\n"),
-            __FUNCTION__,
-            MHD_state_to_string (connection->state));
-#endif
-  if (connection->suspended)
-    return MHD_connection_handle_idle (connection);
-  switch (connection->state)
-    {
-      /* on newly created connections we might reach here before any reply has 
been received */
-    case MHD_TLS_CONNECTION_INIT:
-      break;
-      /* close connection if necessary */
-    case MHD_CONNECTION_CLOSED:
-      return MHD_connection_handle_idle (connection);
-    default:
-      return MHD_connection_handle_idle (connection);
-    }
-  timeout = connection->connection_timeout;
-  if ( (timeout != 0) &&
-       (timeout < (MHD_monotonic_sec_counter() - connection->last_activity)))
-    MHD_connection_close_ (connection,
-                           MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
-#ifdef EPOLL_SUPPORT
-  return MHD_connection_epoll_update_ (connection);
-#else
-  return MHD_YES;
-#endif
-}
-
-
-/**
  * Set connection callback function to be used through out
  * the processing of this secure connection.
  *
@@ -177,7 +130,6 @@ MHD_set_https_callbacks (struct MHD_Connection *connection)
 {
   connection->read_handler = &MHD_tls_connection_handle_read;
   connection->write_handler = &MHD_tls_connection_handle_write;
-  connection->idle_handler = &MHD_tls_connection_handle_idle;
 }
 
 
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 71a0ce0b..01af990c 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1151,7 +1151,7 @@ call_handlers (struct MHD_Connection *con,
           read_ready)
         {
           con->read_handler (con);
-          ret = con->idle_handler (con);
+          ret = MHD_connection_handle_idle (con);
           states_info_processed = true;
         }
       /* No need to check value of 'ret' here as closed connection
@@ -1160,7 +1160,7 @@ call_handlers (struct MHD_Connection *con,
           write_ready)
         {
           con->write_handler (con);
-          ret = con->idle_handler (con);
+          ret = MHD_connection_handle_idle (con);
           states_info_processed = true;
         }
     }
@@ -1168,17 +1168,17 @@ call_handlers (struct MHD_Connection *con,
     {
       MHD_connection_close_ (con,
                              MHD_REQUEST_TERMINATED_WITH_ERROR);
-      return con->idle_handler (con);
+      return MHD_connection_handle_idle (con);
     }
 
   if (!states_info_processed)
     { /* Connection is not read or write ready, but external conditions
        * may be changed and need to be processed. */
-      ret = con->idle_handler (con);
+      ret = MHD_connection_handle_idle (con);
     }
   /* Fast track for fast connections. */
   /* If full request was read by single read_handler() invocation
-     and headers were completely prepared by single idle_handler()
+     and headers were completely prepared by single 
MHD_connection_handle_idle()
      then try not to wait for next sockets polling and send response
      immediately.
      As writeability of socket was not checked and it may have
@@ -1191,17 +1191,17 @@ call_handlers (struct MHD_Connection *con,
       if (MHD_CONNECTION_HEADERS_SENDING == con->state)
         {
           con->write_handler (con);
-          /* Always call 'idle_handler()' after each read/write. */
-          ret = con->idle_handler (con);
+          /* Always call 'MHD_connection_handle_idle()' after each read/write. 
*/
+          ret = MHD_connection_handle_idle (con);
         }
       /* If all headers were sent by single write_handler() and
-       * response body is prepared by single idle_handler()
+       * response body is prepared by single MHD_connection_handle_idle()
        * call - continue. */
       if ((MHD_CONNECTION_NORMAL_BODY_READY == con->state) ||
           (MHD_CONNECTION_CHUNKED_BODY_READY == con->state))
         {
           con->write_handler (con);
-          ret = con->idle_handler (con);
+          ret = MHD_connection_handle_idle (con);
         }
     }
 
@@ -2118,7 +2118,7 @@ thread_main_handle_connection (void *data)
                                (daemon->shutdown) ?
                                MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN:
                                MHD_REQUEST_TERMINATED_WITH_ERROR);
-      con->idle_handler (con);
+      MHD_connection_handle_idle (con);
     }
 exit:
   if (NULL != con->response)
@@ -4428,7 +4428,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
     }
 
   /* Finally, handle timed-out connections; we need to do this here
-     as the epoll mechanism won't call the 'idle_handler' on everything,
+     as the epoll mechanism won't call the 'MHD_connection_handle_idle()' on 
everything,
      as the other event loops do.  As timeouts do not get an explicit
      event, we need to find those connections that might have timed out
      here.
@@ -4439,7 +4439,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
   while (NULL != (pos = prev))
     {
       prev = pos->prevX;
-      pos->idle_handler (pos);
+      MHD_connection_handle_idle (pos);
     }
   /* Connections with the default timeout are sorted by prepending
      them to the head of the list whenever we touch the connection;
@@ -4449,7 +4449,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
   while (NULL != (pos = prev))
     {
       prev = pos->prevX;
-      pos->idle_handler (pos);
+      MHD_connection_handle_idle (pos);
       if (MHD_CONNECTION_CLOSED != pos->state)
        break; /* sorted by timeout, no need to visit the rest! */
     }
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 731416d9..7cb70b42 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -936,12 +936,6 @@ struct MHD_Connection
   int (*write_handler) (struct MHD_Connection *connection);
 
   /**
-   * Handler used for processing idle connection operations
-   * @sa #MHD_connection_handle_idle, #MHD_tls_connection_handle_idle
-   */
-  int (*idle_handler) (struct MHD_Connection *connection);
-
-  /**
    * Function used for reading HTTP request stream.
    */
   ReceiveCallback recv_cls;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]