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 2023/06/29 09:28:24 UTC

svn commit: r1910685 - /httpd/httpd/trunk/modules/http2/h2_c2.c

Author: icing
Date: Thu Jun 29 09:28:24 2023
New Revision: 1910685

URL: http://svn.apache.org/viewvc?rev=1910685&view=rev
Log:
mod_http2: move get_pollfd_from_conn hook outside the HAS_RESPONSE_BUCKET part

Modified:
    httpd/httpd/trunk/modules/http2/h2_c2.c

Modified: httpd/httpd/trunk/modules/http2/h2_c2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_c2.c?rev=1910685&r1=1910684&r2=1910685&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_c2.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_c2.c Thu Jun 29 09:28:24 2023
@@ -469,6 +469,33 @@ static int c2_hook_fixups(request_rec *r
     return DECLINED;
 }
 
+#if H2_USE_POLLFD_FROM_CONN
+static apr_status_t c2_get_pollfd_from_conn(conn_rec *c,
+                                            struct apr_pollfd_t *pfd,
+                                            apr_interval_time_t *ptimeout)
+{
+    if (c->master) {
+        h2_conn_ctx_t *ctx = h2_conn_ctx_get(c);
+        if (ctx) {
+            if (ctx->beam_in && ctx->pipe_in[H2_PIPE_OUT]) {
+                pfd->desc_type = APR_POLL_FILE;
+                pfd->desc.f = ctx->pipe_in[H2_PIPE_OUT];
+                if (ptimeout)
+                    *ptimeout = h2_beam_timeout_get(ctx->beam_in);
+            }
+            else {
+                /* no input */
+                pfd->desc_type = APR_NO_DESC;
+                if (ptimeout)
+                    *ptimeout = -1;
+            }
+            return APR_SUCCESS;
+        }
+    }
+    return APR_ENOTIMPL;
+}
+#endif
+
 #if AP_HAS_RESPONSE_BUCKETS
 
 static void c2_pre_read_request(request_rec *r, conn_rec *c2)
@@ -559,33 +586,6 @@ static int c2_hook_pre_connection(conn_r
     return OK;
 }
 
-#if H2_USE_POLLFD_FROM_CONN
-static apr_status_t c2_get_pollfd_from_conn(conn_rec *c,
-                                            struct apr_pollfd_t *pfd,
-                                            apr_interval_time_t *ptimeout)
-{
-    if (c->master) {
-        h2_conn_ctx_t *ctx = h2_conn_ctx_get(c);
-        if (ctx) {
-            if (ctx->beam_in && ctx->pipe_in[H2_PIPE_OUT]) {
-                pfd->desc_type = APR_POLL_FILE;
-                pfd->desc.f = ctx->pipe_in[H2_PIPE_OUT];
-                if (ptimeout)
-                    *ptimeout = h2_beam_timeout_get(ctx->beam_in);
-            }
-            else {
-                /* no input */
-                pfd->desc_type = APR_NO_DESC;
-                if (ptimeout)
-                    *ptimeout = -1;
-            }
-            return APR_SUCCESS;
-        }
-    }
-    return APR_ENOTIMPL;
-}
-#endif
-
 void h2_c2_register_hooks(void)
 {
     /* When the connection processing actually starts, we might
@@ -912,6 +912,10 @@ void h2_c2_register_hooks(void)
      * install our own. This needs to be done very early. */
     ap_hook_post_read_request(h2_c2_hook_post_read_request, NULL, NULL, APR_HOOK_REALLY_FIRST);
     ap_hook_fixups(c2_hook_fixups, NULL, NULL, APR_HOOK_LAST);
+#if H2_USE_POLLFD_FROM_CONN
+    ap_hook_get_pollfd_from_conn(c2_get_pollfd_from_conn, NULL, NULL,
+                                 APR_HOOK_MIDDLE);
+#endif
 
     ap_register_input_filter("H2_C2_NET_IN", h2_c2_filter_in,
                              NULL, AP_FTYPE_NETWORK);