1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-06 23:03:13 +02:00

Attach client->local->listener to a client very early, now that it is safe.

This makes other code safer as well since they can assume that if the
client is local (client->local) that the listener (client->local->listener)
is non-NULL and safe to access until the client is completely destroyed.
This commit is contained in:
Bram Matthys
2022-06-08 12:26:35 +02:00
parent 1d613a592c
commit 29eb89a528
+2 -3
View File
@@ -810,6 +810,8 @@ Client *add_connection(ConfigItem_listen *listener, int fd)
client = make_client(NULL, &me);
client->local->socket_type = listener->socket_type;
client->local->listener = listener;
client->local->listener->clients++;
if (listener->socket_type == SOCKET_TYPE_UNIX)
ip = "127.0.0.1";
@@ -860,9 +862,6 @@ refuse_client:
break;
}
client->local->listener = listener;
if (client->local->listener != NULL)
client->local->listener->clients++;
add_client_to_list(client);
if (!(listener->options & LISTENER_CONTROL))