Browse Source

[core] mv config_setup_connection to connections.c

rename config_setup_connection() to connection_reset_config()
personal/stbuehler/ci-build
Glenn Strauss 2 years ago
parent
commit
20450fd652
  1. 11
      src/configfile.c
  2. 1
      src/configfile.h
  3. 16
      src/connections.c

11
src/configfile.c

@ -667,17 +667,6 @@ static int config_insert(server *srv) {
}
void config_setup_connection(server *srv, connection *con) {
/* initialize specific_config (con->conf) from top-level specific_config */
specific_config * const s = srv->config_storage[0];
const size_t len = /* offsetof() */
(uintptr_t)&((specific_config *)0)->global_bytes_per_second_cnt_ptr;
con->conf.global_bytes_per_second_cnt_ptr = &s->global_bytes_per_second_cnt;
con->server_name = s->server_name;
memcpy(&con->conf, s, len);
}
#define PATCH(x) con->conf.x = s->x
void config_patch_connection(server *srv, connection *con) {
size_t i, j;

1
src/configfile.h

@ -116,7 +116,6 @@ int config_parse_file(server *srv, config_t *context, const char *fn);
__attribute_cold__
int config_parse_cmd(server *srv, config_t *context, const char *cmd);
void config_setup_connection(server *srv, connection *con);
void config_patch_connection(server *srv, connection *con);
void config_cond_cache_reset(server *srv, connection *con);

16
src/connections.c

@ -535,6 +535,16 @@ static void connection_handle_write_state(server *srv, connection *con) {
}
static void connection_reset_config(server *srv, connection *con) {
/* initialize specific_config (con->conf) from top-level specific_config */
specific_config * const s = srv->config_storage[0];
const size_t len = /* offsetof() */
(uintptr_t)&((specific_config *)0)->global_bytes_per_second_cnt_ptr;
con->conf.global_bytes_per_second_cnt_ptr = &s->global_bytes_per_second_cnt;
con->server_name = s->server_name;
memcpy(&con->conf, s, len);
}
__attribute_cold__
static connection *connection_init(server *srv) {
@ -589,7 +599,7 @@ static connection *connection_init(server *srv) {
con->cond_cache = calloc(srv->config_context->used, sizeof(cond_cache_t));
force_assert(NULL != con->cond_cache);
config_setup_connection(srv, con);
connection_reset_config(srv, con);
return con;
}
@ -700,7 +710,7 @@ static int connection_reset(server *srv, connection *con) {
/*con->error_handler_saved_method = HTTP_METHOD_UNSET;*/
/*(error_handler_saved_method value is not valid unless error_handler_saved_status is set)*/
config_setup_connection(srv, con);
connection_reset_config(srv, con);
return 0;
}
@ -1226,7 +1236,7 @@ static int connection_handle_request(server *srv, connection *con) {
break;
case HANDLER_COMEBACK:
if (con->mode == DIRECT && buffer_is_empty(con->physical.path)) {
config_setup_connection(srv, con);
connection_reset_config(srv, con);
}
return 1;
case HANDLER_ERROR:

Loading…
Cancel
Save