mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-04 19:23:13 +02:00
struct stats *ircstp; -> IRCStatistics ircstats; (for statistics, /STATS)
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ extern MODVAR Client me;
|
||||
extern MODVAR Channel *channel;
|
||||
extern MODVAR ModData local_variable_moddata[MODDATA_MAX_LOCAL_VARIABLE];
|
||||
extern MODVAR ModData global_variable_moddata[MODDATA_MAX_GLOBAL_VARIABLE];
|
||||
extern MODVAR struct stats *ircstp;
|
||||
extern MODVAR IRCStatistics ircstats;
|
||||
extern MODVAR int bootopt;
|
||||
extern MODVAR time_t timeofday;
|
||||
extern MODVAR char cmodestring[512];
|
||||
|
||||
+2
-1
@@ -1659,7 +1659,8 @@ struct ConfigItem_offchans {
|
||||
/*
|
||||
* statistics structures
|
||||
*/
|
||||
struct stats {
|
||||
typedef struct IRCStatistics IRCStatistics;
|
||||
struct IRCStatistics {
|
||||
unsigned int is_cl; /* number of client connections */
|
||||
unsigned int is_sv; /* number of server connections */
|
||||
unsigned int is_ni; /* connection but no idea who it was */
|
||||
|
||||
@@ -241,14 +241,14 @@ static void listener_accept(int listener_fd, int revents, void *data)
|
||||
return;
|
||||
}
|
||||
|
||||
ircstp->is_ac++;
|
||||
ircstats.is_ac++;
|
||||
|
||||
set_sock_opts(cli_fd, NULL, listener->ipv6);
|
||||
set_non_blocking(cli_fd, NULL);
|
||||
|
||||
if ((++OpenFiles >= maxclients) || (cli_fd >= maxclients))
|
||||
{
|
||||
ircstp->is_ref++;
|
||||
ircstats.is_ref++;
|
||||
if (last_allinuse < TStime() - 15)
|
||||
{
|
||||
sendto_ops_and_log("All connections in use. ([@%s/%u])", listener->ip, listener->port);
|
||||
@@ -672,44 +672,44 @@ void close_connection(Client *cptr)
|
||||
{
|
||||
if (IsServer(cptr))
|
||||
{
|
||||
ircstp->is_sv++;
|
||||
ircstp->is_sbs += cptr->local->sendB;
|
||||
ircstp->is_sbr += cptr->local->receiveB;
|
||||
ircstp->is_sks += cptr->local->sendK;
|
||||
ircstp->is_skr += cptr->local->receiveK;
|
||||
ircstp->is_sti += TStime() - cptr->local->firsttime;
|
||||
if (ircstp->is_sbs > 1023)
|
||||
ircstats.is_sv++;
|
||||
ircstats.is_sbs += cptr->local->sendB;
|
||||
ircstats.is_sbr += cptr->local->receiveB;
|
||||
ircstats.is_sks += cptr->local->sendK;
|
||||
ircstats.is_skr += cptr->local->receiveK;
|
||||
ircstats.is_sti += TStime() - cptr->local->firsttime;
|
||||
if (ircstats.is_sbs > 1023)
|
||||
{
|
||||
ircstp->is_sks += (ircstp->is_sbs >> 10);
|
||||
ircstp->is_sbs &= 0x3ff;
|
||||
ircstats.is_sks += (ircstats.is_sbs >> 10);
|
||||
ircstats.is_sbs &= 0x3ff;
|
||||
}
|
||||
if (ircstp->is_sbr > 1023)
|
||||
if (ircstats.is_sbr > 1023)
|
||||
{
|
||||
ircstp->is_skr += (ircstp->is_sbr >> 10);
|
||||
ircstp->is_sbr &= 0x3ff;
|
||||
ircstats.is_skr += (ircstats.is_sbr >> 10);
|
||||
ircstats.is_sbr &= 0x3ff;
|
||||
}
|
||||
}
|
||||
else if (IsUser(cptr))
|
||||
{
|
||||
ircstp->is_cl++;
|
||||
ircstp->is_cbs += cptr->local->sendB;
|
||||
ircstp->is_cbr += cptr->local->receiveB;
|
||||
ircstp->is_cks += cptr->local->sendK;
|
||||
ircstp->is_ckr += cptr->local->receiveK;
|
||||
ircstp->is_cti += TStime() - cptr->local->firsttime;
|
||||
if (ircstp->is_cbs > 1023)
|
||||
ircstats.is_cl++;
|
||||
ircstats.is_cbs += cptr->local->sendB;
|
||||
ircstats.is_cbr += cptr->local->receiveB;
|
||||
ircstats.is_cks += cptr->local->sendK;
|
||||
ircstats.is_ckr += cptr->local->receiveK;
|
||||
ircstats.is_cti += TStime() - cptr->local->firsttime;
|
||||
if (ircstats.is_cbs > 1023)
|
||||
{
|
||||
ircstp->is_cks += (ircstp->is_cbs >> 10);
|
||||
ircstp->is_cbs &= 0x3ff;
|
||||
ircstats.is_cks += (ircstats.is_cbs >> 10);
|
||||
ircstats.is_cbs &= 0x3ff;
|
||||
}
|
||||
if (ircstp->is_cbr > 1023)
|
||||
if (ircstats.is_cbr > 1023)
|
||||
{
|
||||
ircstp->is_ckr += (ircstp->is_cbr >> 10);
|
||||
ircstp->is_cbr &= 0x3ff;
|
||||
ircstats.is_ckr += (ircstats.is_cbr >> 10);
|
||||
ircstats.is_cbr &= 0x3ff;
|
||||
}
|
||||
}
|
||||
else
|
||||
ircstp->is_ni++;
|
||||
ircstats.is_ni++;
|
||||
|
||||
/*
|
||||
* remove outstanding DNS queries.
|
||||
@@ -943,7 +943,7 @@ Client *add_connection(ConfigItem_listen *listener, int fd)
|
||||
report_error("Failed to accept new client %s :%s", acptr);
|
||||
}
|
||||
refuse_client:
|
||||
ircstp->is_ref++;
|
||||
ircstats.is_ref++;
|
||||
acptr->local->fd = -2;
|
||||
free_client(acptr);
|
||||
fd_close(fd);
|
||||
@@ -960,7 +960,7 @@ refuse_client:
|
||||
/* Tag loopback connections */
|
||||
if (is_loopback_ip(acptr->ip))
|
||||
{
|
||||
ircstp->is_loc++;
|
||||
ircstats.is_loc++;
|
||||
SetLocalhost(acptr);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -93,7 +93,7 @@ SpamfilterTargetTable spamfiltertargettable[] = {
|
||||
/*
|
||||
* stats stuff
|
||||
*/
|
||||
struct stats ircst, *ircstp = &ircst;
|
||||
struct IRCStatistics ircstats;
|
||||
|
||||
char *long_date(time_t clock)
|
||||
{
|
||||
@@ -670,7 +670,7 @@ int exit_client(Client *cptr, Client *sptr, Client *from, MessageTag *recv_mtags
|
||||
|
||||
void initstats(void)
|
||||
{
|
||||
memset(&ircst, 0, sizeof(ircst));
|
||||
memset(&ircstats, 0, sizeof(ircstats));
|
||||
}
|
||||
|
||||
void verify_opercount(Client *orig, char *tag)
|
||||
|
||||
@@ -44,7 +44,7 @@ MOD_UNLOAD()
|
||||
static void ident_lookup_failed(Client *cptr)
|
||||
{
|
||||
Debug((DEBUG_NOTICE, "ident_lookup_failed() for %p", cptr));
|
||||
ircstp->is_abad++;
|
||||
ircstats.is_abad++;
|
||||
if (cptr->local->authfd != -1)
|
||||
{
|
||||
fd_close(cptr->local->authfd);
|
||||
@@ -177,9 +177,9 @@ static void ident_lookup_receive(int fd, int revents, void *userdata)
|
||||
{
|
||||
strlcpy(cptr->ident, ident, USERLEN + 1);
|
||||
SetIdentSuccess(cptr);
|
||||
ircstp->is_asuc++;
|
||||
ircstats.is_asuc++;
|
||||
} else {
|
||||
ircstp->is_abad++;
|
||||
ircstats.is_abad++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
+13
-13
@@ -153,7 +153,7 @@ void nick_collision(Client *cptr, char *newnick, char *newid, Client *new, Clien
|
||||
me.name, new->name, me.name, comment);
|
||||
|
||||
/* Exit the client */
|
||||
ircstp->is_kill++;
|
||||
ircstats.is_kill++;
|
||||
SetKilled(new);
|
||||
(void)exit_client(NULL, new, &me, mtags, comment);
|
||||
|
||||
@@ -188,7 +188,7 @@ void nick_collision(Client *cptr, char *newnick, char *newid, Client *new, Clien
|
||||
*/
|
||||
|
||||
/* Exit the client */
|
||||
ircstp->is_kill++;
|
||||
ircstats.is_kill++;
|
||||
SetKilled(existing);
|
||||
(void)exit_client(NULL, existing, &me, mtags, comment);
|
||||
|
||||
@@ -290,7 +290,7 @@ CMD_FUNC(cmd_uid)
|
||||
|
||||
if (IsServer(cptr))
|
||||
{
|
||||
ircstp->is_kill++;
|
||||
ircstats.is_kill++;
|
||||
sendto_umode(UMODE_OPER, "Bad Nick: %s From: %s %s",
|
||||
parv[1], sptr->name, get_client_name(cptr, FALSE));
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (%s <- %s[%s])",
|
||||
@@ -327,7 +327,7 @@ CMD_FUNC(cmd_uid)
|
||||
if (IsServer(cptr) && IsQuarantined(sptr->direction) &&
|
||||
(parc >= 11) && strchr(parv[8], 'o'))
|
||||
{
|
||||
ircstp->is_kill++;
|
||||
ircstats.is_kill++;
|
||||
/* Send kill to uplink only, hasn't been broadcasted to the rest, anyway */
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (Quarantined: no oper privileges allowed)",
|
||||
me.name, parv[1], me.name);
|
||||
@@ -403,7 +403,7 @@ CMD_FUNC(cmd_uid)
|
||||
sendto_umode(UMODE_OPER, "Nick collision on %s(%s <- %s)",
|
||||
sptr->name, acptr->direction->name,
|
||||
get_client_name(cptr, FALSE));
|
||||
ircstp->is_kill++;
|
||||
ircstats.is_kill++;
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (%s <- %s)",
|
||||
me.name, sptr->name, me.name, acptr->direction->name,
|
||||
/* NOTE: Cannot use get_client_name
|
||||
@@ -435,7 +435,7 @@ CMD_FUNC(cmd_uid)
|
||||
/* This is a Bad Thing */
|
||||
sendto_umode(UMODE_OPER, "Lost user field for %s in change from %s",
|
||||
acptr->name, get_client_name(cptr, FALSE));
|
||||
ircstp->is_kill++;
|
||||
ircstats.is_kill++;
|
||||
sendto_one(acptr, NULL, ":%s KILL %s :%s (Lost user field!)",
|
||||
me.name, acptr->name, me.name);
|
||||
SetKilled(acptr);
|
||||
@@ -623,7 +623,7 @@ CMD_FUNC(cmd_nick)
|
||||
|
||||
if (IsServer(cptr))
|
||||
{
|
||||
ircstp->is_kill++;
|
||||
ircstats.is_kill++;
|
||||
sendto_umode(UMODE_OPER, "Bad Nick: %s From: %s %s",
|
||||
parv[1], sptr->name, get_client_name(cptr, FALSE));
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (%s <- %s[%s])",
|
||||
@@ -660,7 +660,7 @@ CMD_FUNC(cmd_nick)
|
||||
if (IsServer(cptr) && IsQuarantined(sptr->direction) &&
|
||||
(parc >= 11) && strchr(parv[8], 'o'))
|
||||
{
|
||||
ircstp->is_kill++;
|
||||
ircstats.is_kill++;
|
||||
/* Send kill to uplink only, hasn't been broadcasted to the rest, anyway */
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (Quarantined: no oper privileges allowed)",
|
||||
me.name, parv[1], me.name);
|
||||
@@ -776,7 +776,7 @@ CMD_FUNC(cmd_nick)
|
||||
sendto_umode(UMODE_OPER, "Nick collision on %s(%s <- %s)",
|
||||
sptr->name, acptr->direction->name,
|
||||
get_client_name(cptr, FALSE));
|
||||
ircstp->is_kill++;
|
||||
ircstats.is_kill++;
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (%s <- %s)",
|
||||
me.name, sptr->name, me.name, acptr->direction->name,
|
||||
/* NOTE: Cannot use get_client_name
|
||||
@@ -816,7 +816,7 @@ CMD_FUNC(cmd_nick)
|
||||
/* This is a Bad Thing */
|
||||
sendto_umode(UMODE_OPER, "Lost user field for %s in change from %s",
|
||||
acptr->name, get_client_name(cptr, FALSE));
|
||||
ircstp->is_kill++;
|
||||
ircstats.is_kill++;
|
||||
sendto_one(acptr, NULL, ":%s KILL %s :%s (Lost user field!)",
|
||||
me.name, acptr->name, me.name);
|
||||
SetKilled(acptr);
|
||||
@@ -1213,7 +1213,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
|
||||
if ((i = check_client(sptr, username)))
|
||||
{
|
||||
ircstp->is_ref++;
|
||||
ircstats.is_ref++;
|
||||
/* Usually the return value of check_client is 0 (allow) or -5 (reject),
|
||||
* but there are some rare cases where the client is not yet killed,
|
||||
* so have a generic exit_client() here to be safe.
|
||||
@@ -1330,13 +1330,13 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
/* Check ban realname { } blocks */
|
||||
if ((bconf = Find_ban(NULL, sptr->info, CONF_BAN_REALNAME)))
|
||||
{
|
||||
ircstp->is_ref++;
|
||||
ircstats.is_ref++;
|
||||
return banned_client(sptr, "realname", bconf->reason?bconf->reason:"", 0, 0);
|
||||
}
|
||||
/* Check G/Z lines before shuns -- kill before quite -- codemastr */
|
||||
if ((xx = find_tkline_match(sptr, 0)) < 0)
|
||||
{
|
||||
ircstp->is_ref++;
|
||||
ircstats.is_ref++;
|
||||
return xx;
|
||||
}
|
||||
find_shun(sptr);
|
||||
|
||||
+3
-3
@@ -593,12 +593,12 @@ int stats_usage(Client *sptr, char *para)
|
||||
int stats_traffic(Client *sptr, char *para)
|
||||
{
|
||||
Client *acptr;
|
||||
struct stats *sp;
|
||||
struct stats tmp;
|
||||
IRCStatistics *sp;
|
||||
IRCStatistics tmp;
|
||||
time_t now = TStime();
|
||||
|
||||
sp = &tmp;
|
||||
memcpy(sp, ircstp, sizeof(*sp));
|
||||
memcpy(sp, &ircstats, sizeof(IRCStatistics));
|
||||
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
{
|
||||
|
||||
+2
-2
@@ -2687,7 +2687,7 @@ int _find_tkline_match(Client *cptr, int skip_soft)
|
||||
|
||||
if (tkl->type & TKL_KILL)
|
||||
{
|
||||
ircstp->is_ref++;
|
||||
ircstats.is_ref++;
|
||||
if (tkl->type & TKL_GLOBAL)
|
||||
return banned_client(cptr, "G-Lined", tkl->ptr.serverban->reason, 1, 0);
|
||||
else
|
||||
@@ -2695,7 +2695,7 @@ int _find_tkline_match(Client *cptr, int skip_soft)
|
||||
}
|
||||
if (tkl->type & TKL_ZAP)
|
||||
{
|
||||
ircstp->is_ref++;
|
||||
ircstats.is_ref++;
|
||||
return banned_client(cptr, "Z-Lined", tkl->ptr.serverban->reason, (tkl->type & TKL_GLOBAL)?1:0, 0);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -197,13 +197,13 @@ int parse2(Client *cptr, Client **fromptr, MessageTag *mtags, char *ch)
|
||||
|
||||
if (!from)
|
||||
{
|
||||
ircstp->is_unpf++;
|
||||
ircstats.is_unpf++;
|
||||
remove_unknown(cptr, sender);
|
||||
return -1;
|
||||
}
|
||||
if (from->direction != cptr)
|
||||
{
|
||||
ircstp->is_wrdi++;
|
||||
ircstats.is_wrdi++;
|
||||
return cancel_clients(cptr, from, ch);
|
||||
}
|
||||
*fromptr = from; /* Update source client */
|
||||
@@ -216,7 +216,7 @@ int parse2(Client *cptr, Client **fromptr, MessageTag *mtags, char *ch)
|
||||
|
||||
if (*ch == '\0')
|
||||
{
|
||||
ircstp->is_empt++;
|
||||
ircstats.is_empt++;
|
||||
Debug((DEBUG_NOTICE, "Empty message from host %s:%s",
|
||||
cptr->name, from->name));
|
||||
if (!IsServer(cptr))
|
||||
@@ -243,7 +243,7 @@ int parse2(Client *cptr, Client **fromptr, MessageTag *mtags, char *ch)
|
||||
numeric = (*ch - '0') * 100 + (*(ch + 1) - '0') * 10
|
||||
+ (*(ch + 2) - '0');
|
||||
paramcount = MAXPARA;
|
||||
ircstp->is_num++;
|
||||
ircstats.is_num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -297,7 +297,7 @@ int parse2(Client *cptr, Client **fromptr, MessageTag *mtags, char *ch)
|
||||
ch, get_client_name(cptr, TRUE)));
|
||||
parse_addlag(cptr, bytes);
|
||||
}
|
||||
ircstp->is_unco++;
|
||||
ircstats.is_unco++;
|
||||
return (-1);
|
||||
}
|
||||
if (cmptr->flags != 0) { /* temporary until all commands are updated */
|
||||
|
||||
Reference in New Issue
Block a user