diff src/event/ngx_event.c @ 8855:9ae239d2547d quic

QUIC: separate event handling functions. The functions ngx_quic_handle_read_event() and ngx_quic_handle_write_event() are added. Previously this code was a part of ngx_handle_read_event() and ngx_handle_write_event(). The change simplifies ngx_handle_read_event() and ngx_handle_write_event() by moving QUIC-related code to a QUIC source file.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 09 Sep 2021 16:55:00 +0300
parents 6674a50cbb6c
children c31d95fdaf65
line wrap: on
line diff
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -273,15 +273,7 @@ ngx_handle_read_event(ngx_event_t *rev, 
     c = rev->data;
 
     if (c->quic) {
-
-        if (!rev->active && !rev->ready) {
-            rev->active = 1;
-
-        } else if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) {
-            rev->active = 0;
-        }
-
-        return NGX_OK;
+        return ngx_quic_handle_read_event(rev, flags);
     }
 
 #endif
@@ -358,28 +350,18 @@ ngx_handle_write_event(ngx_event_t *wev,
 
     c = wev->data;
 
+#if (NGX_QUIC)
+    if (c->quic) {
+        return ngx_quic_handle_write_event(wev, lowat);
+    }
+#endif
+
     if (lowat) {
         if (ngx_send_lowat(c, lowat) == NGX_ERROR) {
             return NGX_ERROR;
         }
     }
 
-#if (NGX_QUIC)
-
-    if (c->quic) {
-
-        if (!wev->active && !wev->ready) {
-            wev->active = 1;
-
-        } else if (wev->active && wev->ready) {
-            wev->active = 0;
-        }
-
-        return NGX_OK;
-    }
-
-#endif
-
     if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
 
         /* kqueue, epoll */