summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-25 20:47:35 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-25 20:47:35 +0000
commite63acfd42200a41705bf4469c8507366592a7100 (patch)
tree143cd0863c1da242948b9bb76dfbb8a9a6d86cda /src/inspircd.cpp
parent77b32677820dfa6ce92395d6d6c02c80f84485b0 (diff)
Added MaxWhoReplies stuff (bahamut-style /WHO limiting)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@729 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index e7afdb5ff..064259c06 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -82,6 +82,7 @@ int WHOWAS_MAX = 100; // default 100 people maximum in the WHOWAS list
int DieDelay = 5;
time_t startup_time = time(NULL);
int NetBufferSize = 10240; // NetBufferSize used as the buffer size for all read() ops
+extern int MaxWhoResults;
time_t nb_start = 0;
extern vector<Module*> modules;
@@ -299,7 +300,7 @@ void readfile(file_cache &F, const char* fname)
void ReadConfig(void)
{
- char dbg[MAXBUF],pauseval[MAXBUF],Value[MAXBUF],timeout[MAXBUF],NB[MAXBUF],flood[MAXBUF];
+ char dbg[MAXBUF],pauseval[MAXBUF],Value[MAXBUF],timeout[MAXBUF],NB[MAXBUF],flood[MAXBUF],MW[MAXBUF];
ConnectClass c;
LoadConf(CONFIG_FILE,&config_f);
@@ -319,12 +320,19 @@ void ReadConfig(void)
ConfValue("die","value",0,DieValue,&config_f);
ConfValue("options","loglevel",0,dbg,&config_f);
ConfValue("options","netbuffersize",0,NB,&config_f);
+ ConfValue("options","maxwho",0,MW,&config_f);
NetBufferSize = atoi(NB);
+ MaxWhoResults = atoi(MW);
if ((!NetBufferSize) || (NetBufferSize > 65535) || (NetBufferSize < 1024))
{
log(DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240.");
NetBufferSize = 10240;
}
+ if ((!MaxWhoResults) || (MaxWhoResults > 65535) || (MaxWhoResults < 1))
+ {
+ log(DEFAULT,"No MaxWhoResults specified or size out of range, setting to default of 128.");
+ MaxWhoResults = 128;
+ }
if (!strcmp(dbg,"debug"))
LogLevel = DEBUG;
if (!strcmp(dbg,"verbose"))
@@ -2096,7 +2104,7 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip)
clientlist[tempnick] = new userrec();
NonBlocking(socket);
- log(DEBUG,"AddClient: %d %s %d",socket,host,port);
+ log(DEBUG,"AddClient: %d %s %d %s",socket,host,port,ip);
clientlist[tempnick]->fd = socket;
strncpy(clientlist[tempnick]->nick, tn2,NICKMAX);
@@ -3545,7 +3553,7 @@ int InspIRCd(void)
}
else
{
- AddClient(incomingSockfd, resolved, ports[count], iscached, target);
+ AddClient(incomingSockfd, resolved, ports[count], iscached, inet_ntoa (client.sin_addr));
log(DEBUG,"InspIRCd: adding client on port %d fd=%d",ports[count],incomingSockfd);
}
goto label;