925 |
|
stats_tstats(struct Client *source_p, int parc, char *parv[]) |
926 |
|
{ |
927 |
|
dlink_node *node; |
928 |
< |
struct ServerStatistics tmp; |
929 |
< |
struct ServerStatistics *sp = &tmp; |
928 |
> |
struct ServerStatistics sp; |
929 |
|
|
930 |
< |
memcpy(sp, &ServerStats, sizeof(struct ServerStatistics)); |
932 |
< |
|
933 |
< |
/* |
934 |
< |
* must use the += operator. is_sv is not the number of currently |
935 |
< |
* active server connections. Note the incrementation in |
936 |
< |
* s_bsd.c:close_connection. |
937 |
< |
*/ |
938 |
< |
sp->is_sv += dlink_list_length(&local_server_list); |
930 |
> |
memcpy(&sp, &ServerStats, sizeof(sp)); |
931 |
|
|
932 |
|
DLINK_FOREACH(node, local_server_list.head) |
933 |
|
{ |
934 |
|
const struct Client *target_p = node->data; |
935 |
|
|
936 |
< |
sp->is_sbs += target_p->connection->send.bytes; |
937 |
< |
sp->is_sbr += target_p->connection->recv.bytes; |
938 |
< |
sp->is_sti += CurrentTime - target_p->connection->firsttime; |
936 |
> |
sp.is_sbs += target_p->connection->send.bytes; |
937 |
> |
sp.is_sbr += target_p->connection->recv.bytes; |
938 |
> |
sp.is_sti += CurrentTime - target_p->connection->firsttime; |
939 |
> |
sp.is_sv++; |
940 |
|
} |
941 |
|
|
949 |
– |
sp->is_cl += dlink_list_length(&local_client_list); |
950 |
– |
|
942 |
|
DLINK_FOREACH(node, local_client_list.head) |
943 |
|
{ |
944 |
|
const struct Client *target_p = node->data; |
945 |
|
|
946 |
< |
sp->is_cbs += target_p->connection->send.bytes; |
947 |
< |
sp->is_cbr += target_p->connection->recv.bytes; |
948 |
< |
sp->is_cti += CurrentTime - target_p->connection->firsttime; |
946 |
> |
sp.is_cbs += target_p->connection->send.bytes; |
947 |
> |
sp.is_cbr += target_p->connection->recv.bytes; |
948 |
> |
sp.is_cti += CurrentTime - target_p->connection->firsttime; |
949 |
> |
sp.is_cl++; |
950 |
|
} |
951 |
|
|
960 |
– |
sp->is_ni += dlink_list_length(&unknown_list); |
961 |
– |
|
952 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
953 |
|
"t :accepts %u refused %u", |
954 |
< |
sp->is_ac, sp->is_ref); |
954 |
> |
sp.is_ac, sp.is_ref); |
955 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
956 |
|
"t :unknown commands %u prefixes %u", |
957 |
< |
sp->is_unco, sp->is_unpf); |
957 |
> |
sp.is_unco, sp.is_unpf); |
958 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
959 |
|
"t :nick collisions %u unknown closes %u", |
960 |
< |
sp->is_kill, sp->is_ni); |
960 |
> |
sp.is_kill, sp.is_ni); |
961 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
962 |
|
"t :wrong direction %u empty %u", |
963 |
< |
sp->is_wrdi, sp->is_empt); |
963 |
> |
sp.is_wrdi, sp.is_empt); |
964 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
965 |
|
"t :numerics seen %u", |
966 |
< |
sp->is_num); |
966 |
> |
sp.is_num); |
967 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
968 |
|
"t :auth successes %u fails %u", |
969 |
< |
sp->is_asuc, sp->is_abad); |
969 |
> |
sp.is_asuc, sp.is_abad); |
970 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
971 |
|
"t :Client Server"); |
972 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
973 |
|
"t :connected %u %u", |
974 |
< |
sp->is_cl, sp->is_sv); |
974 |
> |
sp.is_cl, sp.is_sv); |
975 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
976 |
|
"t :bytes sent %ju %ju", |
977 |
< |
sp->is_cbs, sp->is_sbs); |
977 |
> |
sp.is_cbs, sp.is_sbs); |
978 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
979 |
|
"t :bytes received %ju %ju", |
980 |
< |
sp->is_cbr, sp->is_sbr); |
980 |
> |
sp.is_cbr, sp.is_sbr); |
981 |
|
sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT, |
982 |
|
"t :time connected %ju %ju", |
983 |
< |
sp->is_cti, sp->is_sti); |
983 |
> |
sp.is_cti, sp.is_sti); |
984 |
|
} |
985 |
|
|
986 |
|
static void |