Browse Source

[core] remove connection_list_append()

merge connection_list_append() into connection_fdwaitqueue_append()

(not converted to singly-linked-list since fdwaitqueue is not expected
to be used during normal operation (except extreme overload condition),
so use allocated list of pointers (allocated when needed) instead of
adding ptr member to (every) allocated struct connection)

remove connections-glue.c
remove inclusion of connections.h by non-base files
master
Glenn Strauss 3 months ago
parent
commit
323e03fb2d
  1. 1
      src/CMakeLists.txt
  2. 1
      src/Makefile.am
  3. 1
      src/SConscript
  4. 18
      src/connections-glue.c
  5. 13
      src/connections.c
  6. 2
      src/connections.h
  7. 1
      src/gw_backend.c
  8. 1
      src/meson.build
  9. 1
      src/mod_cgi.c
  10. 1
      src/mod_dirlisting.c
  11. 1
      src/mod_wstunnel.c

1
src/CMakeLists.txt

@ -758,7 +758,6 @@ set(COMMON_SRC
fdevent_poll.c fdevent_linux_sysepoll.c
fdevent_solaris_devpoll.c fdevent_solaris_port.c
fdevent_freebsd_kqueue.c
connections-glue.c
configfile-glue.c
http-header-glue.c
http_cgi.c

1
src/Makefile.am

@ -80,7 +80,6 @@ common_src=base64.c buffer.c burl.c log.c \
fdevent_poll.c fdevent_linux_sysepoll.c \
fdevent_solaris_devpoll.c fdevent_solaris_port.c \
fdevent_freebsd_kqueue.c \
connections-glue.c \
configfile-glue.c \
http-header-glue.c \
http_cgi.c \

1
src/SConscript

@ -64,7 +64,6 @@ common_src = Split("base64.c buffer.c burl.c log.c \
fdevent_poll.c fdevent_linux_sysepoll.c \
fdevent_solaris_devpoll.c fdevent_solaris_port.c \
fdevent_freebsd_kqueue.c \
connections-glue.c \
configfile-glue.c \
http-header-glue.c \
http_cgi.c \

18
src/connections-glue.c

@ -1,18 +0,0 @@
#include "first.h"
#include "base.h"
#include "connections.h"
#include <stdlib.h>
__attribute_cold__
static void connection_list_resize(connections *conns) {
conns->size += 16;
conns->ptr = realloc(conns->ptr, sizeof(*conns->ptr) * conns->size);
force_assert(NULL != conns->ptr);
}
void connection_list_append(connections *conns, connection *con) {
if (conns->used == conns->size) connection_list_resize(conns);
conns->ptr[conns->used++] = con;
}

13
src/connections.c

@ -181,9 +181,20 @@ static void connection_handle_shutdown(connection *con) {
}
}
__attribute_cold__
static void connection_list_resize(connections *conns) {
conns->size += 16;
conns->ptr = realloc(conns->ptr, sizeof(*conns->ptr) * conns->size);
force_assert(NULL != conns->ptr);
}
__attribute_cold__
__attribute_noinline__
static void connection_fdwaitqueue_append(connection *con) {
connection_list_append(&con->srv->fdwaitqueue, con);
connections * const conns = &con->srv->fdwaitqueue;
if (conns->used == conns->size) connection_list_resize(conns);
conns->ptr[conns->used++] = con;
}

2
src/connections.h

@ -22,6 +22,4 @@ connection * connection_accepted(server *srv, const struct server_socket *srv_so
void connection_state_machine(connection *con);
void connection_list_append(connections *conns, connection *con);
#endif

1
src/gw_backend.c

@ -1072,7 +1072,6 @@ static void gw_restart_dead_procs(gw_host * const host, log_error_st * const err
#include "base.h"
#include "connections.h"
#include "response.h"

1
src/meson.build

@ -717,7 +717,6 @@ common_src = [
'burl.c',
'chunk.c',
'configfile-glue.c',
'connections-glue.c',
'http_etag.c',
'fdevent_freebsd_kqueue.c',
'fdevent_libev.c',

1
src/mod_cgi.c

@ -4,7 +4,6 @@
#include "stat_cache.h"
#include "http_kv.h"
#include "log.h"
#include "connections.h"
#include "response.h"
#include "http_cgi.h"
#include "http_chunk.h"

1
src/mod_dirlisting.c

@ -16,7 +16,6 @@
#include "base.h"
#include "log.h"
#include "buffer.h"
#include "connections.h"/* joblist_append() */
#include "fdevent.h"
#include "http_chunk.h"
#include "http_header.h"

1
src/mod_wstunnel.c

@ -90,7 +90,6 @@
#include "fdevent.h"
#include "http_header.h"
#include "log.h"
#include "connections.h"
#define MOD_WEBSOCKET_LOG_NONE 0
#define MOD_WEBSOCKET_LOG_ERR 1

Loading…
Cancel
Save