Skip to content

Commit

Permalink
SSL: improved ngx_ssl_recv_chain() to stop if c->read->ready is 0.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mdounin committed Oct 17, 2019
1 parent 60609f2 commit d2ea226
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/event/ngx_event_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,10 @@ ngx_ssl_recv_chain(ngx_connection_t *c, ngx_chain_t *cl, off_t limit)
last += n;
bytes += n;

if (!c->read->ready) {
return bytes;
}

if (last == b->end) {
cl = cl->next;

Expand Down

0 comments on commit d2ea226

Please sign in to comment.