From 80d12919d131b1f0d59f01e2de0afd12ab9ac601 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Fri, 21 Jun 2019 07:02:45 -0400 Subject: [core] replace connection_set_state w/ assignment replace connection_set_state() with simple assignment (only connections.c and connections-glue.c should change con state) --- src/connections-glue.c | 14 +++----------- src/connections.c | 2 ++ src/connections.h | 1 - 3 files changed, 5 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/connections-glue.c b/src/connections-glue.c index adbb3755..f37f50fc 100644 --- a/src/connections-glue.c +++ b/src/connections-glue.c @@ -45,14 +45,6 @@ const char *connection_get_short_state(connection_state_t state) { } } -int connection_set_state(server *srv, connection *con, connection_state_t state) { - UNUSED(srv); - - con->state = state; - - return 0; -} - static int connection_handle_read_post_cq_compact(chunkqueue *cq) { /* combine first mem chunk with next non-empty mem chunk * (loop if next chunk is empty) */ @@ -389,7 +381,7 @@ static int connection_write_100_continue(server *srv, connection *con) { *(con->conf.global_bytes_per_second_cnt_ptr) += written; if (rc < 0) { - connection_set_state(srv, con, CON_STATE_ERROR); + con->state = CON_STATE_ERROR; return 0; /* error */ } @@ -418,7 +410,7 @@ handler_t connection_handle_read_post_state(server *srv, connection *con) { switch(con->network_read(srv, con, con->read_queue, MAX_READ_LIMIT)) { case -1: - connection_set_state(srv, con, CON_STATE_ERROR); + con->state = CON_STATE_ERROR; return HANDLER_ERROR; case -2: is_closed = 1; @@ -466,7 +458,7 @@ handler_t connection_handle_read_post_state(server *srv, connection *con) { /* Content is ready */ con->conf.stream_request_body &= ~FDEVENT_STREAM_REQUEST_POLLIN; if (con->state == CON_STATE_READ_POST) { - connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST); + con->state = CON_STATE_HANDLE_REQUEST; } return HANDLER_GO_ON; } else if (is_closed) { diff --git a/src/connections.c b/src/connections.c index 1b8e3ffa..52d73f0c 100644 --- a/src/connections.c +++ b/src/connections.c @@ -35,6 +35,8 @@ #define HTTP_LINGER_TIMEOUT 5 +#define connection_set_state(srv, con, n) ((con)->state = (n)) + typedef struct { PLUGIN_DATA; } plugin_data; diff --git a/src/connections.h b/src/connections.h index ba5aaebc..caa310e6 100644 --- a/src/connections.h +++ b/src/connections.h @@ -15,7 +15,6 @@ void connection_periodic_maint (server *srv, time_t cur_ts); connection * connection_accept(server *srv, server_socket *srv_sock); connection * connection_accepted(server *srv, server_socket *srv_socket, sock_addr *cnt_addr, int cnt); -int connection_set_state(server *srv, connection *con, connection_state_t state); const char * connection_get_state(connection_state_t state); const char * connection_get_short_state(connection_state_t state); int connection_state_machine(server *srv, connection *con); -- cgit v1.2.1