comparison 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
comparison
equal deleted inserted replaced
7581:afceb32f3a8a 7582:70749256af79
1919 n = ngx_ssl_recv(c, last, size); 1919 n = ngx_ssl_recv(c, last, size);
1920 1920
1921 if (n > 0) { 1921 if (n > 0) {
1922 last += n; 1922 last += n;
1923 bytes += n; 1923 bytes += n;
1924
1925 if (!c->read->ready) {
1926 return bytes;
1927 }
1924 1928
1925 if (last == b->end) { 1929 if (last == b->end) {
1926 cl = cl->next; 1930 cl = cl->next;
1927 1931
1928 if (cl == NULL) { 1932 if (cl == NULL) {