Welcome! Log In Create A New Profile

Advanced

[nginx] SSL: improved ngx_ssl_recv_chain() to stop if c->read->ready is 0.

Maxim Dounin
October 17, 2019 09:08AM
details: https://hg.nginx.org/nginx/rev/70749256af79
branches:
changeset: 7582:70749256af79
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Oct 17 16:02:13 2019 +0300
description:
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.

diffstat:

src/event/ngx_event_openssl.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diffs (14 lines):

diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
--- 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;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] SSL: improved ngx_ssl_recv_chain() to stop if c->read->ready is 0.

Maxim Dounin 308 October 17, 2019 09:08AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 275
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready