all udp connection event should not add to events group

Gao,Yan(媒体云) gaoyan09 at baidu.com
Fri Jan 28 10:15:15 UTC 2022


# HG changeset patch
# User Gao,Yan(ACG VCP) <gaoyan09 at baidu.com>
# Date 1643364731 -28800
#      Fri Jan 28 18:12:11 2022 +0800
# Branch quic
# Node ID ea58c4329a4b03594737cbe8af1003366f9d1160
# Parent  30cad5a0931e5fd418e2e304b4a6ed5252d39aa2
all udp connection event should not add to events group

diff -r 30cad5a0931e -r ea58c4329a4b src/event/ngx_event.c
--- a/src/event/ngx_event.c Thu Jan 27 13:14:01 2022 +0300
+++ b/src/event/ngx_event.c     Fri Jan 28 18:12:11 2022 +0800
@@ -267,18 +267,14 @@
ngx_int_t
ngx_handle_read_event(ngx_event_t *rev, ngx_uint_t flags)
{
-#if (NGX_QUIC)
-
     ngx_connection_t  *c;
     c = rev->data;
-    if (c->quic) {
-        return ngx_quic_handle_read_event(rev, flags);
+    if (c->udp) {
+        return ngx_udp_handle_read_event(rev, flags);
     }
-#endif
-
     if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
         /* kqueue, epoll */
@@ -351,11 +347,9 @@
     c = wev->data;
-#if (NGX_QUIC)
-    if (c->quic) {
-        return ngx_quic_handle_write_event(wev, lowat);
+    if (c->udp) {
+        return ngx_udp_handle_write_event(wev, lowat);
     }
-#endif
     if (lowat) {
         if (ngx_send_lowat(c, lowat) == NGX_ERROR) {
diff -r 30cad5a0931e -r ea58c4329a4b src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c Thu Jan 27 13:14:01 2022 +0300
+++ b/src/event/ngx_event_openssl.c     Fri Jan 28 18:12:11 2022 +0800
@@ -3149,12 +3149,13 @@
     ngx_err_t   err;
     ngx_uint_t  tries;
-#if (NGX_QUIC)
-    if (c->quic) {
-        /* QUIC streams inherit SSL object */
+    if (c->udp) {
+        /*
+           QUIC streams inherit SSL object
+           pure UDP sessions cannot handle SSL object
+        */
         return NGX_OK;
     }
-#endif
     rc = NGX_OK;
diff -r 30cad5a0931e -r ea58c4329a4b src/event/ngx_event_udp.c
--- a/src/event/ngx_event_udp.c       Thu Jan 27 13:14:01 2022 +0300
+++ b/src/event/ngx_event_udp.c    Fri Jan 28 18:12:11 2022 +0800
@@ -639,3 +639,31 @@
}
 #endif
+
+
+ngx_int_t
+ngx_udp_handle_read_event(ngx_event_t *rev, ngx_uint_t flags)
+{
+    if (!rev->active && !rev->ready) {
+        rev->active = 1;
+
+    } else if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) {
+        rev->active = 0;
+    }
+
+    return NGX_OK;
+}
+
+
+ngx_int_t
+ngx_udp_handle_write_event(ngx_event_t *wev, size_t lowat)
+{
+    if (!wev->active && !wev->ready) {
+        wev->active = 1;
+
+    } else if (wev->active && wev->ready) {
+        wev->active = 0;
+    }
+
+    return NGX_OK;
+}
diff -r 30cad5a0931e -r ea58c4329a4b src/event/ngx_event_udp.h
--- a/src/event/ngx_event_udp.h       Thu Jan 27 13:14:01 2022 +0300
+++ b/src/event/ngx_event_udp.h    Fri Jan 28 18:12:11 2022 +0800
@@ -72,5 +72,7 @@
 void ngx_delete_udp_connection(void *data);
+ngx_int_t ngx_udp_handle_read_event(ngx_event_t *rev, ngx_uint_t flags);
+ngx_int_t ngx_udp_handle_write_event(ngx_event_t *wev, size_t lowat);
 #endif /* _NGX_EVENT_UDP_H_INCLUDED_ */
diff -r 30cad5a0931e -r ea58c4329a4b src/event/quic/ngx_event_quic.h
--- a/src/event/quic/ngx_event_quic.h      Thu Jan 27 13:14:01 2022 +0300
+++ b/src/event/quic/ngx_event_quic.h   Fri Jan 28 18:12:11 2022 +0800
@@ -77,8 +77,6 @@
     const char *reason);
ngx_int_t ngx_quic_reset_stream(ngx_connection_t *c, ngx_uint_t err);
ngx_int_t ngx_quic_shutdown_stream(ngx_connection_t *c, int how);
-ngx_int_t ngx_quic_handle_read_event(ngx_event_t *rev, ngx_uint_t flags);
-ngx_int_t ngx_quic_handle_write_event(ngx_event_t *wev, size_t lowat);
ngx_int_t ngx_quic_get_packet_dcid(ngx_log_t *log, u_char *data, size_t len,
     ngx_str_t *dcid);
ngx_int_t ngx_quic_derive_key(ngx_log_t *log, const char *label,
diff -r 30cad5a0931e -r ea58c4329a4b src/event/quic/ngx_event_quic_streams.c
--- a/src/event/quic/ngx_event_quic_streams.c      Thu Jan 27 13:14:01 2022 +0300
+++ b/src/event/quic/ngx_event_quic_streams.c   Fri Jan 28 18:12:11 2022 +0800
@@ -1569,31 +1569,3 @@
     return NGX_OK;
}
-
-
-ngx_int_t
-ngx_quic_handle_read_event(ngx_event_t *rev, ngx_uint_t flags)
-{
-    if (!rev->active && !rev->ready) {
-        rev->active = 1;
-
-    } else if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) {
-        rev->active = 0;
-    }
-
-    return NGX_OK;
-}
-
-
-ngx_int_t
-ngx_quic_handle_write_event(ngx_event_t *wev, size_t lowat)
-{
-    if (!wev->active && !wev->ready) {
-        wev->active = 1;
-
-    } else if (wev->active && wev->ready) {
-        wev->active = 0;
-    }
-
-    return NGX_OK;
-}

Gao,Yan(ACG VCP)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20220128/43cd2d3a/attachment.htm>


More information about the nginx-devel mailing list