[PATCH 5 of 8] Added to process asynchronous accept

SoYun Seong thdbsdox12 at gmail.com
Tue Nov 24 08:43:33 UTC 2020


# HG changeset patch
# User SoYun Seong <thdbsdox12 at gmail.com>
# Date 1606128989 0
#      Mon Nov 23 10:56:29 2020 +0000
# Node ID bdf6d23007d53d9b76a7666c8db7ece864e31038
# Parent  d7f0f0b78a24724c362cd0306dc6bbed82c66e62
Added to process asynchronous accept

use a result of a requested accept to ngx_uring_module, instead of calling accept() or accept4() system call.

diff -r d7f0f0b78a24 -r bdf6d23007d5 src/event/ngx_event_accept.c
--- a/src/event/ngx_event_accept.c	Mon Nov 23 10:52:02 2020 +0000
+++ b/src/event/ngx_event_accept.c	Mon Nov 23 10:56:29 2020 +0000
@@ -55,15 +55,22 @@
     do {
         socklen = sizeof(ngx_sockaddr_t);
 
+        if(ngx_event_flags & NGX_USE_URING_EVENT)
+        {
+            s = ev->uring_res;
+            sa.sockaddr = *(lc->sockaddr);
+            socklen = lc->socklen;
+        } else {
 #if (NGX_HAVE_ACCEPT4)
-        if (use_accept4) {
-            s = accept4(lc->fd, &sa.sockaddr, &socklen, SOCK_NONBLOCK);
-        } else {
+            if (use_accept4) {
+                s = accept4(lc->fd, &sa.sockaddr, &socklen, SOCK_NONBLOCK);
+            } else {
+                s = accept(lc->fd, &sa.sockaddr, &socklen);
+            }
+#else
             s = accept(lc->fd, &sa.sockaddr, &socklen);
+#endif
         }
-#else
-        s = accept(lc->fd, &sa.sockaddr, &socklen);
-#endif
 
         if (s == (ngx_socket_t) -1) {
             err = ngx_socket_errno;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nginx-5.patch
Type: text/x-patch
Size: 1416 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20201124/35f72cd8/attachment-0001.bin>


More information about the nginx-devel mailing list