You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2015/10/26 14:19:40 UTC

svn commit: r1710594 - in /httpd/httpd/trunk/modules/http2: h2_conn.c h2_h2.c

Author: icing
Date: Mon Oct 26 13:19:40 2015
New Revision: 1710594

URL: http://svn.apache.org/viewvc?rev=1710594&view=rev
Log:
improved timeout handling on main connection, shorter lingering close, conn_state set before read

Modified:
    httpd/httpd/trunk/modules/http2/h2_conn.c
    httpd/httpd/trunk/modules/http2/h2_h2.c

Modified: httpd/httpd/trunk/modules/http2/h2_conn.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_conn.c?rev=1710594&r1=1710593&r2=1710594&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_conn.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_conn.c Mon Oct 26 13:19:40 2015
@@ -40,7 +40,7 @@
 
 static struct h2_workers *workers;
 
-static apr_status_t h2_session_process(h2_session *session);
+static apr_status_t h2_conn_loop(h2_session *session);
 
 static h2_mpm_type_t mpm_type = H2_MPM_UNKNOWN;
 static module *mpm_module;
@@ -150,7 +150,7 @@ apr_status_t h2_conn_rprocess(request_re
         return APR_EGENERAL;
     }
     
-    return h2_session_process(session);
+    return h2_conn_loop(session);
 }
 
 apr_status_t h2_conn_main(conn_rec *c)
@@ -176,7 +176,7 @@ apr_status_t h2_conn_main(conn_rec *c)
                               NGHTTP2_INADEQUATE_SECURITY, NULL, 0);
     } 
 
-    status = h2_session_process(session);
+    status = h2_conn_loop(session);
 
     /* Make sure this connection gets closed properly. */
     c->keepalive = AP_CONN_CLOSE;
@@ -187,7 +187,7 @@ apr_status_t h2_conn_main(conn_rec *c)
     return status;
 }
 
-apr_status_t h2_session_process(h2_session *session)
+static apr_status_t h2_conn_loop(h2_session *session)
 {
     apr_status_t status = APR_SUCCESS;
     int rv = 0;
@@ -282,10 +282,15 @@ apr_status_t h2_session_process(h2_sessi
          *     submit our settings and need the ACK.
          */
         got_streams = !h2_stream_set_is_empty(session->streams);
-        status = h2_session_read(session, 
-                                 (!got_streams 
-                                  || session->frames_received <= 1)?
-                                 APR_BLOCK_READ : APR_NONBLOCK_READ);
+        if (!got_streams || session->frames_received <= 1) {
+            session->c->cs->state = CONN_STATE_WRITE_COMPLETION;
+            status = h2_session_read(session, APR_BLOCK_READ);
+        }
+        else {
+            session->c->cs->state = CONN_STATE_HANDLER;
+            status = h2_session_read(session, APR_NONBLOCK_READ);
+        }
+        
         switch (status) {
             case APR_SUCCESS:       /* successful read, reset our idle timers */
                 have_read = 1;
@@ -303,6 +308,10 @@ apr_status_t h2_session_process(h2_sessi
                     ap_log_cerror( APLOG_MARK, APLOG_DEBUG, status, session->c,
                                   "h2_session(%ld): terminating",
                                   session->id);
+                    /* Stolen from mod_reqtimeout to speed up lingering when
+                     * a read timeout happened.
+                     */
+                    apr_table_setn(session->c->notes, "short-lingering-close", "1");
                 }
                 else {
                     /* uncommon status, log on INFO so that we see this */
@@ -463,7 +472,6 @@ apr_status_t h2_conn_process(conn_rec *c
 {
     AP_DEBUG_ASSERT(c);
     
-    c->clogging_input_filters = 1;
     ap_process_connection(c, socket);
     
     return APR_SUCCESS;

Modified: httpd/httpd/trunk/modules/http2/h2_h2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_h2.c?rev=1710594&r1=1710593&r2=1710594&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_h2.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_h2.c Mon Oct 26 13:19:40 2015
@@ -548,7 +548,7 @@ void h2_h2_register_hooks(void)
     ap_hook_post_read_request(h2_h2_post_read_req, NULL, NULL, APR_HOOK_REALLY_FIRST);
 }
 
-int h2_h2_remove_timeout(conn_rec* c)
+static int h2_h2_remove_timeout(conn_rec* c)
 {
     h2_ctx *ctx = h2_ctx_get(c);