diff src/event/ngx_event_openssl.c @ 7582:70749256af79

SSL: improved ngx_ssl_recv_chain() to stop if c->read->ready is 0. As long as there are data to read in the socket, yet the amount of data is less than total size of the buffers in the chain, this saves one unneeded read() syscall. Before this change, reading only stopped if ngx_ssl_recv() returned no data, that is, two read() syscalls in a row returned EAGAIN.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 17 Oct 2019 16:02:13 +0300
parents 2432a687e789
children 9d2ad2fb4423
line wrap: on
line diff
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -1922,6 +1922,10 @@ ngx_ssl_recv_chain(ngx_connection_t *c, 
             last += n;
             bytes += n;
 
+            if (!c->read->ready) {
+                return bytes;
+            }
+
             if (last == b->end) {
                 cl = cl->next;