170 |
{ |
{ |
171 |
assert(client_p->localClient->invited.head == NULL); |
assert(client_p->localClient->invited.head == NULL); |
172 |
assert(dlink_list_length(&client_p->localClient->invited) == 0); |
assert(dlink_list_length(&client_p->localClient->invited) == 0); |
173 |
assert(dlink_list_length(&client_p->localClient->watches) == 0); |
assert(dlink_list_length(&client_p->localClient->watches) == 0); |
174 |
assert(IsClosing(client_p) && IsDead(client_p)); |
assert(IsClosing(client_p) && IsDead(client_p)); |
175 |
|
|
176 |
MyFree(client_p->localClient->response); |
MyFree(client_p->localClient->response); |
183 |
{ |
{ |
184 |
assert(0 < client_p->localClient->listener->ref_count); |
assert(0 < client_p->localClient->listener->ref_count); |
185 |
if (0 == --client_p->localClient->listener->ref_count && |
if (0 == --client_p->localClient->listener->ref_count && |
186 |
!client_p->localClient->listener->active) |
!client_p->localClient->listener->active) |
187 |
free_listener(client_p->localClient->listener); |
free_listener(client_p->localClient->listener); |
188 |
} |
} |
189 |
|
|
202 |
* |
* |
203 |
* inputs - NOT USED (from event) |
* inputs - NOT USED (from event) |
204 |
* output - next time_t when check_pings() should be called again |
* output - next time_t when check_pings() should be called again |
205 |
* side effects - |
* side effects - |
206 |
* |
* |
207 |
* |
* |
208 |
* A PING can be sent to clients as necessary. |
* A PING can be sent to clients as necessary. |
224 |
|
|
225 |
static void |
static void |
226 |
check_pings(void *notused) |
check_pings(void *notused) |
227 |
{ |
{ |
228 |
check_pings_list(&local_client_list); |
check_pings_list(&local_client_list); |
229 |
check_pings_list(&serv_list); |
check_pings_list(&serv_list); |
230 |
check_unknowns_list(); |
check_unknowns_list(); |
234 |
* |
* |
235 |
* inputs - pointer to list to check |
* inputs - pointer to list to check |
236 |
* output - NONE |
* output - NONE |
237 |
* side effects - |
* side effects - |
238 |
*/ |
*/ |
239 |
static void |
static void |
240 |
check_pings_list(dlink_list *list) |
check_pings_list(dlink_list *list) |
254 |
if (IsDead(client_p)) |
if (IsDead(client_p)) |
255 |
{ |
{ |
256 |
/* Ignore it, its been exited already */ |
/* Ignore it, its been exited already */ |
257 |
continue; |
continue; |
258 |
} |
} |
259 |
|
|
260 |
if (!IsRegistered(client_p)) |
if (!IsRegistered(client_p)) |
335 |
* side effects - Check all connections for a pending kline against the |
* side effects - Check all connections for a pending kline against the |
336 |
* client, exit the client if a kline matches. |
* client, exit the client if a kline matches. |
337 |
*/ |
*/ |
338 |
void |
void |
339 |
check_conf_klines(void) |
check_conf_klines(void) |
340 |
{ |
{ |
341 |
struct Client *client_p = NULL; /* current local client_p being examined */ |
struct Client *client_p = NULL; /* current local client_p being examined */ |
342 |
struct MaskItem *conf = NULL; |
struct MaskItem *conf = NULL; |
343 |
dlink_node *ptr, *next_ptr; |
dlink_node *ptr, *next_ptr; |
373 |
} |
} |
374 |
|
|
375 |
ban_them(client_p, conf); |
ban_them(client_p, conf); |
376 |
/* and go examine next fd/client_p */ |
/* and go examine next fd/client_p */ |
377 |
continue; |
continue; |
378 |
} |
} |
379 |
|
|
380 |
if ((conf = find_kill(client_p)) != NULL) |
if ((conf = find_kill(client_p)) != NULL) |
381 |
{ |
{ |
382 |
if (IsExemptKline(client_p)) |
if (IsExemptKline(client_p)) |
383 |
{ |
{ |
388 |
} |
} |
389 |
|
|
390 |
ban_them(client_p, conf); |
ban_them(client_p, conf); |
391 |
continue; |
continue; |
392 |
} |
} |
393 |
|
|
394 |
if ((conf = find_matching_name_conf(CONF_XLINE, client_p->info, |
if ((conf = find_matching_name_conf(CONF_XLINE, client_p->info, |
469 |
* |
* |
470 |
* input - pointer to client |
* input - pointer to client |
471 |
* output - NONE |
* output - NONE |
472 |
* side effects - |
* side effects - |
473 |
*/ |
*/ |
474 |
static void |
static void |
475 |
update_client_exit_stats(struct Client *client_p) |
update_client_exit_stats(struct Client *client_p) |
520 |
} |
} |
521 |
|
|
522 |
/* |
/* |
523 |
* find_chasing - find the client structure for a nick name (user) |
* find_chasing - find the client structure for a nick name (user) |
524 |
* using history mechanism if necessary. If the client is not found, |
* using history mechanism if necessary. If the client is not found, |
525 |
* an error message (NO SUCH NICK) is generated. If the client was found |
* an error message (NO SUCH NICK) is generated. If the client was found |
526 |
* through the history, chasing will be 1 and otherwise 0. |
* through the history, chasing will be 1 and otherwise 0. |
527 |
*/ |
*/ |
579 |
|
|
580 |
assert(client != NULL); |
assert(client != NULL); |
581 |
|
|
582 |
if (!MyConnect(client)) |
if (!MyConnect(client)) |
583 |
return client->name; |
return client->name; |
584 |
|
|
585 |
if (IsServer(client) || IsConnecting(client) || IsHandshake(client)) |
if (IsServer(client) || IsConnecting(client) || IsHandshake(client)) |
623 |
free_exited_clients(void) |
free_exited_clients(void) |
624 |
{ |
{ |
625 |
dlink_node *ptr = NULL, *next = NULL; |
dlink_node *ptr = NULL, *next = NULL; |
626 |
|
|
627 |
DLINK_FOREACH_SAFE(ptr, next, dead_list.head) |
DLINK_FOREACH_SAFE(ptr, next, dead_list.head) |
628 |
{ |
{ |
629 |
free_client(ptr->data); |
free_client(ptr->data); |
752 |
} |
} |
753 |
} |
} |
754 |
|
|
755 |
/* |
/* |
756 |
* Remove all clients that depend on source_p; assumes all (S)QUITs have |
* Remove all clients that depend on source_p; assumes all (S)QUITs have |
757 |
* already been sent. we make sure to exit a server's dependent clients |
* already been sent. we make sure to exit a server's dependent clients |
758 |
* and servers before the server itself; exit_one_client takes care of |
* and servers before the server itself; exit_one_client takes care of |
759 |
* actually removing things off llists. tweaked from +CSr31 -orabidoo |
* actually removing things off llists. tweaked from +CSr31 -orabidoo |
760 |
*/ |
*/ |
761 |
static void |
static void |
922 |
|
|
923 |
if (ConfigServerHide.hide_servers) |
if (ConfigServerHide.hide_servers) |
924 |
/* |
/* |
925 |
* Set netsplit message to "*.net *.split" to still show |
* Set netsplit message to "*.net *.split" to still show |
926 |
* that its a split, but hide the servers splitting |
* that its a split, but hide the servers splitting |
927 |
*/ |
*/ |
928 |
strcpy(splitstr, "*.net *.split"); |
strcpy(splitstr, "*.net *.split"); |
940 |
source_p->localClient->send.bytes >> 10, |
source_p->localClient->send.bytes >> 10, |
941 |
source_p->localClient->recv.bytes >> 10); |
source_p->localClient->recv.bytes >> 10); |
942 |
ilog(LOG_TYPE_IRCD, "%s was connected for %d seconds. %llu/%llu sendK/recvK.", |
ilog(LOG_TYPE_IRCD, "%s was connected for %d seconds. %llu/%llu sendK/recvK.", |
943 |
source_p->name, (int)(CurrentTime - source_p->localClient->firsttime), |
source_p->name, (int)(CurrentTime - source_p->localClient->firsttime), |
944 |
source_p->localClient->send.bytes >> 10, |
source_p->localClient->send.bytes >> 10, |
945 |
source_p->localClient->recv.bytes >> 10); |
source_p->localClient->recv.bytes >> 10); |
946 |
} |
} |
1009 |
if (IsServer(client_p) || IsHandshake(client_p)) |
if (IsServer(client_p) || IsHandshake(client_p)) |
1010 |
{ |
{ |
1011 |
int connected = CurrentTime - client_p->localClient->firsttime; |
int connected = CurrentTime - client_p->localClient->firsttime; |
1012 |
|
|
1013 |
if (error == 0) |
if (error == 0) |
1014 |
{ |
{ |
1015 |
/* Admins get the real IP */ |
/* Admins get the real IP */ |
1079 |
else |
else |
1080 |
notice = "Write error: connection closed"; |
notice = "Write error: connection closed"; |
1081 |
|
|
1082 |
exit_client(target_p, &me, notice); |
exit_client(target_p, &me, notice); |
1083 |
free_dlink_node(ptr); |
free_dlink_node(ptr); |
1084 |
} |
} |
1085 |
} |
} |