Skip to content
Snippets Groups Projects
Commit ebf12222 authored by David Vasek's avatar David Vasek Committed by Daniel Salzman
Browse files

no dynamic configuration: replace ifacelist_t with former (list_t) l, drop the (list_t) u

parent 30f2ebcf
No related branches found
No related tags found
1 merge request!1066Abandon workers reconfiguration
......@@ -318,9 +318,8 @@ static int configure_sockets(conf_t *conf, server_t *s)
/* Prepare helper lists. */
int bound = 0;
ifacelist_t *newlist = malloc(sizeof(ifacelist_t));
init_list(&newlist->u);
init_list(&newlist->l);
list_t *newlist = malloc(sizeof(list_t));
init_list(newlist);
/* Update bound interfaces. */
conf_val_t listen_val = conf_get(conf, C_SRV, C_LISTEN);
......@@ -338,7 +337,7 @@ static int configure_sockets(conf_t *conf, server_t *s)
unsigned size = s->handlers[IO_UDP].handler.unit->size;
if (server_init_iface(m, &addr, size) >= 0) {
/* Move to new list. */
add_tail(&newlist->l, (node_t *)m);
add_tail(newlist, (node_t *)m);
++bound;
} else {
free(m);
......@@ -421,7 +420,7 @@ void server_deinit(server_t *server)
/* Free remaining interfaces. */
if (server->ifaces) {
iface_t *n = NULL, *m = NULL;
WALK_LIST_DELSAFE(n, m, server->ifaces->l) {
WALK_LIST_DELSAFE(n, m, *server->ifaces) {
server_remove_iface(n);
}
free(server->ifaces);
......@@ -606,7 +605,7 @@ static bool listen_changed(conf_t *conf, server_t *server)
/* Duplicate current list. */
/*! \note Pointers to addr, handlers etc. will be shared. */
list_dup(&iface_list, &server->ifaces->l, sizeof(iface_t));
list_dup(&iface_list, server->ifaces, sizeof(iface_t));
conf_val_t listen_val = conf_get(conf, C_SRV, C_LISTEN);
conf_val_t rundir_val = conf_get(conf, C_SRV, C_RUNDIR);
......@@ -898,7 +897,7 @@ void server_update_zones(conf_t *conf, server_t *server)
}
}
ifacelist_t *server_set_ifaces(server_t *server, fdset_t *fds, int index, int thread_id)
list_t *server_set_ifaces(server_t *server, fdset_t *fds, int index, int thread_id)
{
if (server == NULL || server->ifaces == NULL || fds == NULL) {
return NULL;
......@@ -908,7 +907,7 @@ ifacelist_t *server_set_ifaces(server_t *server, fdset_t *fds, int index, int th
fdset_clear(fds);
iface_t *i = NULL;
WALK_LIST(i, server->ifaces->l) {
WALK_LIST(i, *server->ifaces) {
#ifdef ENABLE_REUSEPORT
int udp_id = thread_id % i->fd_udp_count;
#else
......
......@@ -64,11 +64,6 @@ enum {
IO_TCP = 1
};
typedef struct ifacelist {
list_t l;
list_t u;
} ifacelist_t;
/*!
* \brief Main server structure.
*
......@@ -98,7 +93,7 @@ typedef struct server {
evsched_t sched;
/*! \brief List of interfaces. */
ifacelist_t *ifaces;
list_t *ifaces;
} server_t;
......@@ -177,4 +172,4 @@ void server_update_zones(conf_t *conf, server_t *server);
*
* \return new interface list
*/
ifacelist_t *server_set_ifaces(server_t *server, fdset_t *fds, int index, int thread_id);
list_t *server_set_ifaces(server_t *server, fdset_t *fds, int index, int thread_id);
......@@ -377,12 +377,12 @@ static int iface_udp_fd(const iface_t *iface, int thread_id)
*
* \return Number of watched descriptors, zero on error.
*/
static nfds_t track_ifaces(const ifacelist_t *ifaces, int thrid,
static nfds_t track_ifaces(const list_t *ifaces, int thrid,
struct pollfd **fds_ptr)
{
assert(ifaces && fds_ptr);
nfds_t nfds = list_size(&ifaces->l);
nfds_t nfds = list_size(ifaces);
struct pollfd *fds = malloc(nfds * sizeof(*fds));
if (!fds) {
*fds_ptr = NULL;
......@@ -391,7 +391,7 @@ static nfds_t track_ifaces(const ifacelist_t *ifaces, int thrid,
iface_t *iface = NULL;
int i = 0;
WALK_LIST(iface, ifaces->l) {
WALK_LIST(iface, *ifaces) {
fds[i].fd = iface_udp_fd(iface, thrid);
fds[i].events = POLLIN;
fds[i].revents = 0;
......
/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -98,7 +98,7 @@ void udp_master_init_stdio(server_t *server) {
ifc->fd_udp[0] = STDIN_FILENO;
ifc->fd_udp_count = 1;
add_tail(&server->ifaces->l, (node_t *)ifc);
add_tail(server->ifaces, (node_t *)ifc);
_udp_init = udp_stdin_init;
_udp_recv = udp_stdin_recv;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment