90 |
|
{ |
91 |
|
client_p->from = client_p; /* 'from' of local client is self! */ |
92 |
|
client_p->connection = xcalloc(sizeof(*client_p->connection)); |
93 |
< |
client_p->connection->since = CurrentTime; |
94 |
< |
client_p->connection->lasttime = CurrentTime; |
95 |
< |
client_p->connection->firsttime = CurrentTime; |
93 |
> |
client_p->connection->last_data = event_base->time.sec_monotonic; |
94 |
> |
client_p->connection->last_ping = event_base->time.sec_monotonic; |
95 |
> |
client_p->connection->created_real = event_base->time.sec_real; |
96 |
> |
client_p->connection->created_monotonic = event_base->time.sec_monotonic; |
97 |
|
client_p->connection->registration = REG_INIT; |
98 |
|
|
99 |
|
/* as good a place as any... */ |
215 |
|
continue; /* Ignore it, it's been exited already */ |
216 |
|
|
217 |
|
unsigned int ping = get_client_ping(&client_p->connection->confs); |
218 |
< |
if (ping < CurrentTime - client_p->connection->lasttime) |
218 |
> |
if (ping < event_base->time.sec_monotonic - client_p->connection->last_ping) |
219 |
|
{ |
220 |
|
if (!HasFlag(client_p, FLAGS_PINGSENT)) |
221 |
|
{ |
225 |
|
* it is still alive. |
226 |
|
*/ |
227 |
|
AddFlag(client_p, FLAGS_PINGSENT); |
228 |
< |
client_p->connection->lasttime = CurrentTime - ping; |
228 |
> |
client_p->connection->last_ping = event_base->time.sec_monotonic - ping; |
229 |
|
sendto_one(client_p, "PING :%s", ID_or_name(&me, client_p)); |
230 |
|
} |
231 |
|
else |
232 |
|
{ |
233 |
< |
if (CurrentTime - client_p->connection->lasttime >= 2 * ping) |
233 |
> |
if (event_base->time.sec_monotonic - client_p->connection->last_ping >= 2 * ping) |
234 |
|
{ |
235 |
|
/* |
236 |
|
* If the client/server hasn't talked to us in 2*ping seconds |
249 |
|
} |
250 |
|
|
251 |
|
snprintf(buf, sizeof(buf), "Ping timeout: %ji seconds", |
252 |
< |
(CurrentTime - client_p->connection->lasttime)); |
252 |
> |
(event_base->time.sec_monotonic - client_p->connection->last_ping)); |
253 |
|
exit_client(client_p, buf); |
254 |
|
} |
255 |
|
} |
277 |
|
* Check UNKNOWN connections - if they have been in this state |
278 |
|
* for > 30s, close them. |
279 |
|
*/ |
280 |
< |
if ((CurrentTime - client_p->connection->firsttime) <= 30) |
280 |
> |
if ((event_base->time.sec_monotonic - client_p->connection->created_monotonic) <= 30) |
281 |
|
continue; |
282 |
|
|
283 |
|
if (IsHandshake(client_p)) |
595 |
|
++ServerStats.is_cl; |
596 |
|
ServerStats.is_cbs += client_p->connection->send.bytes; |
597 |
|
ServerStats.is_cbr += client_p->connection->recv.bytes; |
598 |
< |
ServerStats.is_cti += CurrentTime - client_p->connection->firsttime; |
598 |
> |
ServerStats.is_cti += event_base->time.sec_monotonic - client_p->connection->created_monotonic; |
599 |
|
} |
600 |
|
else if (IsServer(client_p)) |
601 |
|
{ |
604 |
|
++ServerStats.is_sv; |
605 |
|
ServerStats.is_sbs += client_p->connection->send.bytes; |
606 |
|
ServerStats.is_sbr += client_p->connection->recv.bytes; |
607 |
< |
ServerStats.is_sti += CurrentTime - client_p->connection->firsttime; |
607 |
> |
ServerStats.is_sti += event_base->time.sec_monotonic - client_p->connection->created_monotonic; |
608 |
|
|
609 |
|
DLINK_FOREACH(node, connect_items.head) |
610 |
|
{ |
802 |
|
source_p->sockhost, comment); |
803 |
|
|
804 |
|
ilog(LOG_TYPE_USER, "%s (%ju): %s!%s@%s %s %s %ju/%ju :%s", |
805 |
< |
date_ctime(source_p->connection->firsttime), |
806 |
< |
CurrentTime - source_p->connection->firsttime, |
805 |
> |
date_ctime(source_p->connection->created_real), |
806 |
> |
event_base->time.sec_monotonic - source_p->connection->created_monotonic, |
807 |
|
source_p->name, source_p->username, source_p->host, |
808 |
|
source_p->sockhost, source_p->account, |
809 |
|
source_p->connection->send.bytes >> 10, |
862 |
|
{ |
863 |
|
sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE, |
864 |
|
"%s was connected for %s. %ju/%ju sendK/recvK.", |
865 |
< |
source_p->name, time_dissect(CurrentTime - source_p->connection->firsttime), |
865 |
> |
source_p->name, time_dissect(event_base->time.sec_monotonic - source_p->connection->created_monotonic), |
866 |
|
source_p->connection->send.bytes >> 10, |
867 |
|
source_p->connection->recv.bytes >> 10); |
868 |
|
ilog(LOG_TYPE_IRCD, "%s was connected for %s. %ju/%ju sendK/recvK.", |
869 |
< |
source_p->name, time_dissect(CurrentTime - source_p->connection->firsttime), |
869 |
> |
source_p->name, time_dissect(event_base->time.sec_monotonic - source_p->connection->created_monotonic), |
870 |
|
source_p->connection->send.bytes >> 10, |
871 |
|
source_p->connection->recv.bytes >> 10); |
872 |
|
} |
955 |
|
|
956 |
|
sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE, |
957 |
|
"%s was connected for %s", |
958 |
< |
client_p->name, time_dissect(CurrentTime - client_p->connection->firsttime)); |
958 |
> |
client_p->name, time_dissect(event_base->time.sec_monotonic - client_p->connection->created_monotonic)); |
959 |
|
} |
960 |
|
|
961 |
|
if (error == 0) |