Kaynağa Gözat

Fixed logic of idle disconnection: connection should be disconnected not early than "timeout",
not before "timeout" number of seconds.

Evgeny Grin (Karlson2k) 9 yıl önce
ebeveyn
işleme
88fee01b55
3 değiştirilmiş dosya ile 6 ekleme ve 2 silme
  1. 4 0
      ChangeLog
  2. 1 1
      src/microhttpd/connection.c
  3. 1 1
      src/microhttpd/connection_https.c

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+Thu Mar 16 23:12:07 MSK 2017
+	Idle connection should be disconnected *after* "timeout" number of
+	second, not *before* this number. -EG/VT
+
 Thu Mar 16 22:31:54 MSK 2017
 	Unified update of last activity on connections.
 	Update last activity only if something is really transmitted.

+ 1 - 1
src/microhttpd/connection.c

@@ -3219,7 +3219,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
       unsigned int timeout;
       timeout = connection->connection_timeout;
       if ( (0 != timeout) &&
-           (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity)) )
+           (timeout < (MHD_monotonic_sec_counter() - connection->last_activity)) )
         {
           MHD_connection_close_ (connection,
                                  MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);

+ 1 - 1
src/microhttpd/connection_https.c

@@ -155,7 +155,7 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
     }
   timeout = connection->connection_timeout;
   if ( (timeout != 0) &&
-       (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity)))
+       (timeout < (MHD_monotonic_sec_counter() - connection->last_activity)))
     MHD_connection_close_ (connection,
                            MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
 #ifdef EPOLL_SUPPORT