diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2021-09-17 11:49:55 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2021-09-28 11:05:55 -0400 |
commit | f19f71625cbf2d9ec482ae831e68ef7f66aa62bb (patch) | |
tree | 0e0df1e95de8b34d34b48ca0b989b0a31b66982a /src/connections.c | |
parent | d59d5e59b929b55653c1ad61378715f1ab439fbe (diff) | |
download | lighttpd-git-f19f71625cbf2d9ec482ae831e68ef7f66aa62bb.tar.gz |
[multiple] internal control for backend read bytes
separate internal control for backend max_per_read
When not streaming, large reads will be flushed to temp files on disk.
When streaming, use a smaller buffer to help reduce memory usage.
When not streaming, attempt to read and empty kernel socket bufs.
(e.g. MAX_READ_LIMIT 256k)
When writing to sockets (or pipes) attempt to fill kernel socket bufs.
(e.g. MAX_WRITE_LIMIT 256k)
Diffstat (limited to 'src/connections.c')
-rw-r--r-- | src/connections.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/connections.c b/src/connections.c index c7532b20..5639d3e7 100644 --- a/src/connections.c +++ b/src/connections.c @@ -1896,8 +1896,14 @@ connection_handle_read_post_state (request_st * const r) } else if (con->is_readable > 0) { con->read_idle_ts = log_monotonic_secs; - - switch(con->network_read(con, cq, MAX_READ_LIMIT)) { + const off_t max_per_read = + !(r->conf.stream_request_body /*(if not streaming request body)*/ + & (FDEVENT_STREAM_REQUEST|FDEVENT_STREAM_REQUEST_BUFMIN)) + ? MAX_READ_LIMIT + : (r->conf.stream_request_body & FDEVENT_STREAM_REQUEST_BUFMIN) + ? 16384 /* FDEVENT_STREAM_REQUEST_BUFMIN */ + : 65536; /* FDEVENT_STREAM_REQUEST */ + switch(con->network_read(con, cq, max_per_read)) { case -1: connection_set_state_error(r, CON_STATE_ERROR); return HANDLER_ERROR; |