Unverified Commit cba02091 authored by hev's avatar hev Committed by DL6ER
Browse files

Optimize inserting records into server list.


Signed-off-by: default avatarhev <r@hev.cc>
Signed-off-by: default avatarDL6ER <dl6er@dl6er.de>
parent 94d5fdf2
......@@ -1114,7 +1114,7 @@ extern struct daemon {
char *lease_change_command;
struct iname *if_names, *if_addrs, *if_except, *dhcp_except, *auth_peers, *tftp_interfaces;
struct bogus_addr *bogus_addr, *ignore_addr;
struct server *servers, *local_domains, **serverarray, *no_rebind;
struct server *servers, *servers_tail, *local_domains, **serverarray, *no_rebind;
int server_has_wildcard;
int serverarraysz, serverarrayhwm;
struct ipsets *ipsets;
......
......@@ -576,7 +576,10 @@ void cleanup_servers(void)
free(serv);
}
else
{
up = &serv->next;
daemon->servers_tail = serv;
}
}
for (serv = daemon->local_domains, up = &daemon->local_domains; serv; serv = tmp)
......@@ -673,18 +676,14 @@ int add_update_server(int flags,
}
else
{
struct server *s;
memset(serv, 0, sizeof(struct server));
/* Add to the end of the chain, for order */
if (!daemon->servers)
daemon->servers = serv;
if (daemon->servers_tail)
daemon->servers_tail->next = serv;
else
{
for (s = daemon->servers; s->next; s = s->next);
s->next = serv;
}
daemon->servers = serv;
daemon->servers_tail = serv;
#ifdef HAVE_LOOP
serv->uid = rand32();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment