From bfac0285a7c9ceb658a25b7a9b86d832d146c746 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Sun, 19 Jun 2016 19:32:46 -0400 Subject: [PATCH] remove excess calls to joblist_append() (recent commits streamlined dynamic handler flow control) --- src/connections-glue.c | 4 +--- src/connections.c | 3 --- src/mod_fastcgi.c | 12 +++++++----- src/network.c | 4 ---- src/server.c | 1 - 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/connections-glue.c b/src/connections-glue.c index 3f4b4738..c242718d 100644 --- a/src/connections-glue.c +++ b/src/connections-glue.c @@ -212,10 +212,8 @@ static int connection_handle_read_ssl(server *srv, connection *con) { return -2; } else { - joblist_append(srv, con); + return 0; } - - return 0; #else UNUSED(srv); UNUSED(con); diff --git a/src/connections.c b/src/connections.c index 27e6838c..c2b5351e 100644 --- a/src/connections.c +++ b/src/connections.c @@ -383,18 +383,15 @@ static int connection_handle_write(server *srv, connection *con) { con->write_request_ts = srv->cur_ts; if (con->file_finished) { connection_set_state(srv, con, CON_STATE_RESPONSE_END); - joblist_append(srv, con); } break; case -1: /* error on our side */ log_error_write(srv, __FILE__, __LINE__, "sd", "connection closed: write failed on fd", con->fd); connection_set_state(srv, con, CON_STATE_ERROR); - joblist_append(srv, con); break; case -2: /* remote close */ connection_set_state(srv, con, CON_STATE_ERROR); - joblist_append(srv, con); break; case 1: con->write_request_ts = srv->cur_ts; diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c index f61ca98e..5a9b983f 100644 --- a/src/mod_fastcgi.c +++ b/src/mod_fastcgi.c @@ -2383,9 +2383,6 @@ range_success: ; if (have_sendfile2) { data_string *dcls; - hctx->send_content_body = 0; - joblist_append(srv, con); - /* fix content-length */ if (NULL == (dcls = (data_string *)array_get_unused_element(con->response.headers, TYPE_STRING))) { dcls = data_response_init(); @@ -2397,6 +2394,7 @@ range_success: ; con->parsed_response |= HTTP_CONTENT_LENGTH; con->response.content_length = sendfile2_content_length; + return 200; } /* CGI/1.1 rev 03 - 7.2.1.2 */ @@ -2614,9 +2612,13 @@ static int fcgi_demux_response(server *srv, handler_ctx *hctx) { /* parse the response header */ if ((ret = fcgi_response_parse(srv, con, p, hctx->response_header))) { - con->http_status = ret; - hctx->send_content_body = 0; + if (200 != ret) { /*(200 returned for X-Sendfile2 handled)*/ + con->http_status = ret; + con->mode = DIRECT; + } con->file_started = 1; + hctx->send_content_body = 0; + fin = 1; break; } diff --git a/src/network.c b/src/network.c index 18b8b47e..489c4cae 100644 --- a/src/network.c +++ b/src/network.c @@ -1070,9 +1070,7 @@ int network_write_chunkqueue(server *srv, connection *con, chunkqueue *cq, off_t off_t limit = con->conf.global_kbytes_per_second * 1024 - *(con->conf.global_bytes_per_second_cnt_ptr); if (limit <= 0) { /* we reached the global traffic limit */ - con->traffic_limit_reached = 1; - joblist_append(srv, con); return 1; } else { @@ -1084,9 +1082,7 @@ int network_write_chunkqueue(server *srv, connection *con, chunkqueue *cq, off_t off_t limit = con->conf.kbytes_per_second * 1024 - con->bytes_written_cur_second; if (limit <= 0) { /* we reached the traffic limit */ - con->traffic_limit_reached = 1; - joblist_append(srv, con); return 1; } else { diff --git a/src/server.c b/src/server.c index d0c14f99..22261d56 100644 --- a/src/server.c +++ b/src/server.c @@ -1781,7 +1781,6 @@ int main (int argc, char **argv) { handler = fdevent_get_handler(srv->ev, fd); context = fdevent_get_context(srv->ev, fd); - /* connection_handle_fdevent needs a joblist_append */ #if 0 log_error_write(srv, __FILE__, __LINE__, "sdd", "event for", fd, revents); -- 2.11.4.GIT