1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-04 09:23:12 +02:00

- Exorcize HTM (heavy traffic mode) from Unreal.

This is partially for the sake of Stskeeps, even though he left the
  project long ago, but mainly so we can work towards dynamic ticks in
  the event loop while guaranteeing latencies for connected clients,
  even with fakelag.
This commit is contained in:
William Pitcock
2012-11-05 05:49:04 +00:00
parent 31c357bf76
commit 856be31a8d
12 changed files with 9 additions and 570 deletions
-14
View File
@@ -55,20 +55,6 @@ extern MODVAR time_t timeofday;
#define CMD_FUNC(x) int (x) (aClient *cptr, aClient *sptr, int parc, char *parv[])
#ifndef NO_FDLIST
extern MODVAR float currentrate;
extern MODVAR float currentrate2; /* outgoing */
extern MODVAR float highest_rate;
extern MODVAR float highest_rate2;
extern MODVAR int lifesux;
extern MODVAR int LRV;
extern MODVAR time_t LCF;
extern MODVAR int currlife;
extern MODVAR int HTMLOCK;
extern MODVAR int noisy_htm;
extern MODVAR long lastsendK, lastrecvK;
#endif
/*
* Configuration linked lists
*/
-4
View File
@@ -55,10 +55,6 @@ aChannel *channel = NullChn;
extern char backupbuf[];
extern ircstats IRCstats;
#ifndef NO_FDLIST
extern int lifesux;
#endif
/* Some forward declarations */
void add_invite(aClient *, aChannel *);
char *clean_ban_mask(char *, int, aClient *);
+1 -22
View File
@@ -116,19 +116,6 @@ fdlist default_fdlist;
fdlist serv_fdlist;
fdlist oper_fdlist;
fdlist unknown_fdlist;
float currentrate;
float currentrate2; /* outgoing */
float highest_rate = 0;
float highest_rate2 = 0;
int lifesux = 0;
int LRV = LOADRECV;
TS LCF = LOADCFREQ;
int currlife = 0;
int HTMLOCK = 0;
int noisy_htm = 1;
long lastrecvK = 0;
long lastsendK = 0;
#endif
unsigned char conf_debuglevel = 0;
@@ -1746,16 +1733,12 @@ void SocketLoop(void *dummy)
LockEventSystem();
DoEvents();
UnlockEventSystem();
/*
* ** Run through the hashes and check lusers every
* ** second
* ** also check for expiring glines
*/
#ifndef NO_FDLIST
lastrecvK = me.receiveK;
lastsendK = me.sendK;
#endif
if (IRCstats.clients > IRCstats.global_max)
IRCstats.global_max = IRCstats.clients;
if (IRCstats.me_clients > IRCstats.me_max)
@@ -1809,11 +1792,7 @@ void SocketLoop(void *dummy)
* ** time might be too far away... (similarly with
* ** ping times) --msa
*/
#ifdef NO_FDLIST
if (timeofday >= nextping || loop.do_bancheck)
#else
if ((timeofday >= nextping && !lifesux) || loop.do_bancheck)
#endif
nextping = check_pings(timeofday);
if (dorehash)
{
+2 -9
View File
@@ -37,7 +37,7 @@ R_MODULES= \
m_setident.so m_sdesc.so m_svsmode.so m_swhois.so\
m_svsmotd.so m_svsnline.so m_who.so m_mkpasswd.so \
m_away.so m_svsnoop.so m_svso.so m_svsnick.so \
m_adminchat.so m_akill.so m_chgname.so m_guest.so m_htm.so m_kill.so \
m_adminchat.so m_akill.so m_chgname.so m_guest.so m_kill.so \
m_lag.so m_message.so m_nachat.so m_oper.so m_pingpong.so \
m_quit.so m_rakill.so m_rping.so m_sendumode.so m_sqline.so \
m_tsctl.so m_unkline.so m_unsqline.so m_unzline.so m_whois.so \
@@ -61,7 +61,7 @@ R_MODULES= \
COMMANDS=m_sethost.o m_chghost.o m_chgident.o m_setname.o m_setident.o \
m_sdesc.o m_svsmode.o m_swhois.o m_svsmotd.o m_svsnline.o \
m_who.o m_mkpasswd.o m_away.o m_svsnoop.o m_svso.o m_svsnick.o \
m_adminchat.o m_akill.o m_chgname.o m_guest.o m_htm.o m_kill.o \
m_adminchat.o m_akill.o m_chgname.o m_guest.o m_kill.o \
m_lag.o m_message.o webtv.o m_nachat.o m_oper.o m_pingpong.o \
m_quit.o m_rakill.o m_rping.o m_sendumode.o m_sqline.o \
m_tsctl.o m_unkline.o m_unsqline.o m_unzline.o m_whois.o \
@@ -114,9 +114,6 @@ m_chgname.o: m_chgname.c $(INCLUDES)
m_guest.o: m_guest.c $(INCLUDES)
$(CC) $(CFLAGS) $(MODULEFLAGS) -c m_guest.c
m_htm.o: m_htm.c $(INCLUDES)
$(CC) $(CFLAGS) $(MODULEFLAGS) -c m_htm.c
m_kill.o: m_kill.c $(INCLUDES)
$(CC) $(CFLAGS) $(MODULEFLAGS) -c m_kill.c
@@ -446,10 +443,6 @@ m_guest.so: m_guest.c $(INCLUDES)
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
-o m_guest.so m_guest.c
m_htm.so: m_htm.c $(INCLUDES)
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
-o m_htm.so m_htm.c
m_kill.so: m_kill.c $(INCLUDES)
$(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \
-o m_kill.so m_kill.c
+4 -8
View File
@@ -72,7 +72,7 @@ ModuleHeader l_commands_Header
* want to
*/
extern int m_htm_Test(ModuleInfo *modinfo), m_join_Test(ModuleInfo *modinfo);
extern int m_join_Test(ModuleInfo *modinfo);
extern int m_mode_Test(ModuleInfo *modinfo), m_nick_Test(ModuleInfo *modinfo);
extern int m_tkl_Test(ModuleInfo *modinfo), m_list_Test(ModuleInfo *modinfo);
extern int m_message_Test(ModuleInfo *modinfo), m_server_Test(ModuleInfo *modinfo);
@@ -85,7 +85,7 @@ extern int m_svsnline_Init(ModuleInfo *modinfo), m_who_Init(ModuleInfo *modinfo)
extern int m_away_Init(ModuleInfo *modinfo), m_svsnoop_Init(ModuleInfo *modinfo), m_svso_Init(ModuleInfo *modinfo);
extern int m_svsnick_Init(ModuleInfo *modinfo), m_adminchat_Init(ModuleInfo *modinfo), m_nachat_Init(ModuleInfo *modinfo);
extern int m_lag_Init(ModuleInfo *modinfo), m_rping_Init(ModuleInfo *modinfo), m_sendumode_Init(ModuleInfo *modinfo);
extern int m_tsctl_Init(ModuleInfo *modinfo), m_htm_Init(ModuleInfo *modinfo), m_chgname_Init(ModuleInfo *modinfo);
extern int m_tsctl_Init(ModuleInfo *modinfo), m_chgname_Init(ModuleInfo *modinfo);
extern int m_message_Init(ModuleInfo *modinfo), m_whois_Init(ModuleInfo *modinfo), m_quit_Init(ModuleInfo *modinfo);
extern int m_kill_Init(ModuleInfo *modinfo), m_pingpong_Init(ModuleInfo *modinfo), m_oper_Init(ModuleInfo *modinfo);
extern int m_akill_Init(ModuleInfo *modinfo), m_rakill_Init(ModuleInfo *modinfo), m_userip_Init(ModuleInfo *modinfo);
@@ -139,7 +139,7 @@ extern int m_svsnline_Load(int module_load), m_who_Load(int module_load), m_mkpa
extern int m_away_Load(int module_load), m_svsnoop_Load(int module_load), m_svso_Load(int module_load);
extern int m_svsnick_Load(int module_load), m_adminchat_Load(int module_load), m_nachat_Load(int module_load);
extern int m_lag_Load(int module_load), m_rping_Load(int module_load), m_sendumode_Load(int module_load);
extern int m_tsctl_Load(int module_load), m_htm_Load(int module_load), m_chgname_Load(int module_load);
extern int m_tsctl_Load(int module_load), m_chgname_Load(int module_load);
extern int m_message_Load(int module_load), m_whois_Load(int module_load), m_quit_Load(int module_load);
extern int m_kill_Load(int module_load), m_pingpong_Load(int module_load), m_oper_Load(int module_load);
extern int m_akill_Load(int module_load), m_rakill_Load(int module_load), m_userip_Load(int unused);
@@ -191,7 +191,7 @@ extern int m_setident_Unload(), m_sdesc_Unload(), m_svsmode_Unload(), m_swhois_U
extern int m_svsmotd_Unload(), m_svsnline_Unload(), m_who_Unload(), m_mkpasswd_Unload();
extern int m_away_Unload(), m_svsnoop_Unload(), m_svso_Unload(), m_svsnick_Unload();
extern int m_adminchat_Unload(), m_nachat_Unload(), m_lag_Unload(), m_rping_Unload();
extern int m_sendumode_Unload(), m_tsctl_Unload(), m_htm_Unload(), m_chgname_Unload();
extern int m_sendumode_Unload(), m_tsctl_Unload(), m_chgname_Unload();
extern int m_message_Unload(), m_whois_Unload(), m_quit_Unload(), m_kill_Unload();
extern int m_pingpong_Unload(), m_oper_Unload(), m_akill_Unload(), m_rakill_Unload();
extern int m_unzline_Unload(), m_unkline_Unload(), m_userip_Unload();
@@ -238,7 +238,6 @@ int l_commands_Test(ModuleInfo *modinfo)
#endif
MARK_AS_OFFICIAL_MODULE(modinfo);
ModCmdsInfo = modinfo;
m_htm_Test(ModCmdsInfo);
m_join_Test(ModCmdsInfo);
m_mode_Test(ModCmdsInfo);
m_nick_Test(ModCmdsInfo);
@@ -287,7 +286,6 @@ int l_commands_Init(ModuleInfo *modinfo)
m_rping_Init(ModCmdsInfo);
m_sendumode_Init(ModCmdsInfo);
m_tsctl_Init(ModCmdsInfo);
m_htm_Init(ModCmdsInfo);
m_chgname_Init(ModCmdsInfo);
m_message_Init(ModCmdsInfo);
m_whois_Init(ModCmdsInfo);
@@ -404,7 +402,6 @@ int l_commands_Load(int module_load)
m_rping_Load(module_load);
m_sendumode_Load(module_load);
m_tsctl_Load(module_load);
m_htm_Load(module_load);
m_chgname_Load(module_load);
m_message_Load(module_load);
m_whois_Load(module_load);
@@ -521,7 +518,6 @@ int l_commands_Unload(int module_unload)
m_rping_Unload();
m_sendumode_Unload();
m_tsctl_Unload();
m_htm_Unload();
m_chgname_Unload();
m_message_Unload();
m_whois_Unload();
-484
View File
@@ -1,484 +0,0 @@
/*
* Unreal Internet Relay Chat Daemon, src/modules/m_htm.c
* (C) 2000-2001 Carsten V. Munk and the UnrealIRCd Team
* Moved to modules by Fish (Justin Hammond)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "channel.h"
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <io.h>
#endif
#include <fcntl.h>
#include "h.h"
#include "proto.h"
#ifdef STRIPBADWORDS
#include "badwords.h"
#endif
#ifdef _WIN32
#include "version.h"
#endif
DLLFUNC int m_htm(aClient *cptr, aClient *sptr, int parc, char *parv[]);
EVENT(lcf_check);
EVENT(htm_calc);
Event *e_lcf, *e_htmcalc;
/* Place includes here */
#define MSG_HTM "HTM"
#define TOK_HTM "BH"
DLLFUNC int htm_config_test(ConfigFile *, ConfigEntry *, int, int *);
DLLFUNC int htm_config_run(ConfigFile *, ConfigEntry *, int);
DLLFUNC int htm_stats(aClient *, char *);
ModuleInfo *HtmModInfo;
static Hook *ConfTest, *ConfRun, *ServerStats;
ModuleHeader MOD_HEADER(m_htm)
= {
"htm", /* Name of module */
"$Id$", /* Version */
"command /htm", /* Short description of module */
"3.2-b8-1",
NULL
};
DLLFUNC int MOD_TEST(m_htm)(ModuleInfo *modinfo)
{
/*
* We call our add_Command crap here
*/
HtmModInfo = modinfo;
ConfTest = HookAddEx(HtmModInfo->handle, HOOKTYPE_CONFIGTEST, htm_config_test);
return MOD_SUCCESS;
}
/* This is called on module init, before Server Ready */
DLLFUNC int MOD_INIT(m_htm)(ModuleInfo *modinfo)
{
/*
* We call our add_Command crap here
*/
add_Command(MSG_HTM, TOK_HTM, m_htm, MAXPARA);
ConfRun = HookAddEx(HtmModInfo->handle, HOOKTYPE_CONFIGRUN, htm_config_run);
ServerStats = HookAddEx(HtmModInfo->handle, HOOKTYPE_STATS, htm_stats);
#ifndef NO_FDLIST
LockEventSystem();
e_lcf = EventAddEx(HtmModInfo->handle, "lcf", LCF, 0, lcf_check, NULL);
e_htmcalc = EventAddEx(HtmModInfo->handle, "htmcalc", 1, 0, htm_calc, NULL);
UnlockEventSystem();
#endif
MARK_AS_OFFICIAL_MODULE(modinfo);
return MOD_SUCCESS;
}
/* Is first run when server is 100% ready */
DLLFUNC int MOD_LOAD(m_htm)(int module_load)
{
return MOD_SUCCESS;
}
/* Called when module is unloaded */
DLLFUNC int MOD_UNLOAD(m_htm)(int module_unload)
{
if (del_Command(MSG_HTM, TOK_HTM, m_htm) < 0)
{
sendto_realops("Failed to delete commands when unloading %s",
MOD_HEADER(m_htm).name);
}
#ifndef NO_FDLIST
LockEventSystem();
EventDel(e_lcf);
EventDel(e_htmcalc);
UnlockEventSystem();
#endif
return MOD_SUCCESS;
}
/* m_htm recoded by griever
parameters
HTM [server] [command] [param]
*/
DLLFUNC int m_htm(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
int x = HUNTED_NOSUCH;
char *command, *param;
if (!IsOper(sptr))
{
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, sptr->name);
return 0;
}
switch(parc) {
case 1:
break;
case 2:
x = hunt_server_token_quiet(cptr, sptr, MSG_HTM, TOK_HTM, "%s", 1, parc, parv);
break;
case 3:
x = hunt_server_token_quiet(cptr, sptr, MSG_HTM, TOK_HTM, "%s %s", 1, parc, parv);
break;
default:
x = hunt_server_token_quiet(cptr, sptr, MSG_HTM, TOK_HTM, "%s %s %s", 1, parc, parv);
}
switch (x) {
case HUNTED_NOSUCH:
command = (parv[1]);
param = (parv[2]);
break;
case HUNTED_ISME:
command = (parv[2]);
param = (parv[3]);
break;
default:
return 0;
}
#ifndef NO_FDLIST
if (!command)
{
sendto_one(sptr,
":%s NOTICE %s :*** Current incoming rate: %0.2f kb/s",
me.name, parv[0], currentrate);
sendto_one(sptr,
":%s NOTICE %s :*** Current outgoing rate: %0.2f kb/s",
me.name, parv[0], currentrate2);
sendto_one(sptr,
":%s NOTICE %s :*** Highest incoming rate: %0.2f kb/s",
me.name, parv[0], highest_rate);
sendto_one(sptr,
":%s NOTICE %s :*** Highest outgoing rate: %0.2f kb/s",
me.name, parv[0], highest_rate2);
sendto_one(sptr,
":%s NOTICE %s :*** High traffic mode is currently \2%s\2",
me.name, parv[0], (lifesux ? "ON" : "OFF"));
sendto_one(sptr,
":%s NOTICE %s :*** High traffic mode is currently in \2%s\2 mode",
me.name, parv[0], (noisy_htm ? "NOISY" : "QUIET"));
sendto_one(sptr,
":%s NOTICE %s :*** HTM will be activated if incoming > %i kb/s",
me.name, parv[0], LRV);
}
else
{
if (!stricmp(command, "ON"))
{
EventInfo mod;
lifesux = 1;
sendto_one(sptr,
":%s NOTICE %s :High traffic mode is now ON.",
me.name, parv[0]);
sendto_ops
("%s (%s@%s) forced High traffic mode to activate",
parv[0], sptr->user->username,
GetHost(sptr));
LCF = 60; /* 60 seconds */
mod.flags = EMOD_EVERY;
mod.every = LCF;
LockEventSystem();
EventMod(e_lcf, &mod);
UnlockEventSystem();
}
else if (!stricmp(command, "OFF"))
{
EventInfo mod;
lifesux = 0;
LCF = LOADCFREQ;
mod.flags = EMOD_EVERY;
mod.every = LCF;
LockEventSystem();
EventMod(e_lcf, &mod);
UnlockEventSystem();
sendto_one(sptr,
":%s NOTICE %s :High traffic mode is now OFF.",
me.name, parv[0]);
sendto_ops
("%s (%s@%s) forced High traffic mode to deactivate",
parv[0], sptr->user->username,
GetHost(sptr));
}
else if (!stricmp(command, "TO"))
{
if (!param)
sendto_one(sptr,
":%s NOTICE %s :You must specify an integer value",
me.name, parv[0]);
else
{
int new_val = atoi(param);
if (new_val < 10)
sendto_one(sptr,
":%s NOTICE %s :New value must be > 10",
me.name, parv[0]);
else
{
LRV = new_val;
sendto_one(sptr,
":%s NOTICE %s :New max rate is %dkb/s",
me.name, parv[0], LRV);
sendto_ops
("%s (%s@%s) changed the High traffic mode max rate to %dkb/s",
parv[0], sptr->user->username,
GetHost(sptr), LRV);
}
}
}
else if (!stricmp(command, "QUIET"))
{
noisy_htm = 0;
sendto_one(sptr,
":%s NOTICE %s :High traffic mode is now QUIET",
me.name, parv[0]);
sendto_ops("%s (%s@%s) set High traffic mode to QUIET",
parv[0], sptr->user->username,
GetHost(sptr));
}
else if (!stricmp(command, "NOISY"))
{
noisy_htm = 1;
sendto_one(sptr,
":%s NOTICE %s :High traffic mode is now NOISY",
me.name, parv[0]);
sendto_ops("%s (%s@%s) set High traffic mode to NOISY",
parv[0], sptr->user->username,
GetHost(sptr));
}
else
sendto_one(sptr, ":%s NOTICE %s :Unknown option: %s",
me.name, parv[0], command);
}
#else
sendto_one(sptr,
":%s NOTICE %s :*** High traffic mode and fdlists are not enabled on this server",
me.name, sptr->name);
#endif
return 0;
}
#ifndef NO_FDLIST
EVENT(lcf_check)
{
static int lrv;
lrv = LRV * LCF;
if ((me.receiveK - lrv >= lastrecvK) || HTMLOCK == 1)
{
if (!lifesux)
{
lifesux = 1;
if (noisy_htm)
sendto_realops
("Entering high-traffic mode (incoming = %0.2f kb/s (LRV = %dk/s, outgoing = %0.2f kb/s currently)",
currentrate, LRV,
currentrate2);}
else
{
EventInfo mod;
lifesux++; /* Ok, life really sucks! */
LCF += 2; /* wait even longer */
mod.flags = EMOD_EVERY;
mod.every = LCF;
EventMod(e_lcf, &mod);
if (noisy_htm)
sendto_realops
("Still high-traffic mode %d%s (%d delay): %0.2f kb/s",
lifesux,
(lifesux >
9) ? " (TURBO)" :
"", (int)LCF, currentrate);
/* Reset htm here, because its been on a little too long.
* Bad Things(tm) tend to happen with HTM on too long -epi */
if (lifesux > 15)
{
EventInfo mod;
if (noisy_htm)
sendto_realops
("Resetting HTM and raising limit to: %dk/s\n",
LRV + 5);
LCF = LOADCFREQ;
mod.flags = EMOD_EVERY;
mod.every = LCF;
EventMod(e_lcf, &mod);
lifesux = 0;
LRV += 5;
}
}
}
else
{
EventInfo mod;
LCF = LOADCFREQ;
mod.flags = EMOD_EVERY;
mod.every = LCF;
EventMod(e_lcf, &mod);
if (lifesux)
{
lifesux = 0;
if (noisy_htm)
sendto_realops
("Resuming standard operation (incoming = %0.2f kb/s, outgoing = %0.2f kb/s now)",
currentrate, currentrate2);
}
}
}
EVENT(htm_calc)
{
static time_t last = 0;
if (last == 0)
last = TStime();
if (timeofday - last == 0)
return;
currentrate =
((float)(me.receiveK -
lastrecvK)) / ((float)(timeofday - last));
currentrate2 =
((float)(me.sendK -
lastsendK)) / ((float)(timeofday - last));
if (currentrate > highest_rate)
highest_rate = currentrate;
if (currentrate2 > highest_rate2)
highest_rate2 = currentrate2;
last = TStime();
}
#endif
DLLFUNC int htm_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
ConfigEntry *cep;
int errors = 0;
if (type != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "htm"))
{
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
{
if (!cep->ce_varname)
{
config_error("%s:%i: blank set::htm item",
cep->ce_fileptr->cf_filename,
cep->ce_varlinenum);
errors++;
continue;
}
if (!cep->ce_vardata)
{
config_error("%s:%i: set::htm::%s item without value",
cep->ce_fileptr->cf_filename,
cep->ce_varlinenum, cep->ce_varname);
errors++;
continue;
}
if (!strcmp(cep->ce_varname, "mode"))
{
if (stricmp(cep->ce_vardata, "noisy") && stricmp(cep->ce_vardata, "quiet"))
{
config_error("%s%i: set::htm::mode: illegal mode",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
errors++;
}
}
else if (!strcmp(cep->ce_varname, "incoming-rate"))
{
int value = config_checkval(cep->ce_vardata, CFG_SIZE);
if (value < 10240)
{
config_error("%s%i: set::htm::incoming-rate: must be at least 10kb",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
errors++;
}
}
else
{
config_error("%s:%i: unknown directive set::htm::%s",
cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
cep->ce_varname);
errors++;
}
}
*errs = errors;
return errors ? -1 : 1;
}
else
return 0;
}
DLLFUNC int htm_config_run(ConfigFile *cf, ConfigEntry *ce, int type) {
ConfigEntry *cep;
if (type != CONFIG_SET)
return 0;
if (!strcmp(ce->ce_varname, "htm"))
{
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
{
if (!strcmp(cep->ce_varname, "mode"))
{
if (!stricmp(cep->ce_vardata, "noisy"))
noisy_htm = 1;
else
noisy_htm = 0;
}
else if (!strcmp(cep->ce_varname, "incoming-rate"))
{
LRV = config_checkval(cep->ce_vardata, CFG_SIZE);
LRV /= 1024;
}
}
return 1;
}
return 0;
}
DLLFUNC int htm_stats(aClient *sptr, char *stats) {
if (*stats == 'S') {
sendto_one(sptr, ":%s %i %s :htm::mode: %s", me.name, RPL_TEXT,
sptr->name, noisy_htm ? "noisy" : "quiet");
sendto_one(sptr, ":%s %i %s :htm::incoming-rate: %d kb/s", me.name, RPL_TEXT,
sptr->name, LRV);
}
return 0;
}
-11
View File
@@ -140,17 +140,6 @@ DLLFUNC CMD_FUNC(m_list)
return 0;
}
/* if HTM, drop this too */
#ifndef NO_FDLIST
if (lifesux && !IsOper(cptr))
{
sendto_one(sptr, err_str(ERR_HTMDISABLED), me.name,
sptr->name, "/List");
/* We need this for mIRC compatibility -- codemastr */
sendto_one(sptr, rpl_str(RPL_LISTEND), me.name, parv[0]);
return 0;
}
#endif
if (parc < 2 || BadPtr(parv[1]))
{
+1 -1
View File
@@ -206,7 +206,7 @@ DLLFUNC CMD_FUNC(m_names)
buf[idx++] = '+';
}
if (lifesux || !uhnames) {
if (!uhnames) {
s = acptr->name;
} else {
strlcpy(nuhBuffer,
+1 -5
View File
@@ -795,11 +795,7 @@ int stats_traffic(aClient *sptr, char *para)
sp->is_ckr, sp->is_cbr, sp->is_skr, sp->is_sbr);
sendto_one(sptr, ":%s %d %s :time connected %ld %ld",
me.name, RPL_STATSDEBUG, sptr->name, sp->is_cti, sp->is_sti);
#ifndef NO_FDLIST
sendto_one(sptr,
":%s %d %s :incoming rate %0.2f kb/s - outgoing rate %0.2f kb/s",
me.name, RPL_STATSDEBUG, sptr->name, currentrate, currentrate2);
#endif
return 0;
}
-9
View File
@@ -653,15 +653,6 @@ static void do_other_who(aClient *sptr, char *mask)
{
int oper = IsAnOper(sptr);
/* wildcard? */
#ifndef NO_FDLIST
if (lifesux && !IsOper(sptr) && *mask == '*' && *(mask+1) == 0)
{
sendto_one(sptr, err_str(ERR_HTMDISABLED), me.name,
sptr->name, "/WHO");
return;
}
#endif
if (strchr(mask, '*') || strchr(mask, '?'))
{
int i = 0;
-1
View File
@@ -49,7 +49,6 @@ char backupbuf[8192];
/*
* NOTE: parse() should not be called recursively by other functions!
*/
extern int lifesux;
static char *para[MAXPARA + 2];
static char sender[HOSTLEN + 1];
-2
View File
@@ -58,8 +58,6 @@ Computing Center and Jarkko Oikarinen";
#ifndef NO_FDLIST
extern fdlist serv_fdlist;
extern fdlist oper_fdlist;
extern float currentrate;
extern float currentrate2;
#endif
extern ircstats IRCstats;
extern char *me_hash;