Przeglądaj źródła

HTTPS connection: fixed double processing of timeout

Evgeny Grin (Karlson2k) 9 lat temu
rodzic
commit
605bb70bde
1 zmienionych plików z 5 dodań i 5 usunięć
  1. 5 5
      src/microhttpd/connection_https.c

+ 5 - 5
src/microhttpd/connection_https.c

@@ -142,11 +142,6 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
 #endif
   if (connection->suspended)
     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);
   switch (connection->state)
     {
       /* on newly created connections we might reach here before any reply has been received */
@@ -158,6 +153,11 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *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