summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-08 14:33:38 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-08 14:33:38 +0000
commit15e7fc7ac5699e198fc3fc155bf8a641d9db2d4a (patch)
tree627f8d048ee497cea0d1af4bd1bb2ebfa127a863 /src/inspircd.cpp
parentf3017195549d748d2373ec51a6c798a6e3a61d00 (diff)
Added customizable pingfreq
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1012 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 141e56679..dd8f9e824 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -318,7 +318,7 @@ void readfile(file_cache &F, const char* fname)
void ReadConfig(bool bail, userrec* user)
{
char dbg[MAXBUF],pauseval[MAXBUF],Value[MAXBUF],timeout[MAXBUF],NB[MAXBUF],flood[MAXBUF],MW[MAXBUF];
- char AH[MAXBUF],AP[MAXBUF],AF[MAXBUF],DNT[MAXBUF];
+ char AH[MAXBUF],AP[MAXBUF],AF[MAXBUF],DNT[MAXBUF],pfreq[MAXBUF];
ConnectClass c;
std::stringstream errstr;
@@ -420,6 +420,7 @@ void ReadConfig(bool bail, userrec* user)
ConfValue("connect","allow",i,Value,&config_f);
ConfValue("connect","timeout",i,timeout,&config_f);
ConfValue("connect","flood",i,flood,&config_f);
+ ConfValue("connect","pingfreq",i,pfreq,&config_f);
if (strcmp(Value,""))
{
strlcpy(c.host,Value,MAXBUF);
@@ -428,11 +429,16 @@ void ReadConfig(bool bail, userrec* user)
ConfValue("connect","password",i,Value,&config_f);
strlcpy(c.pass,Value,MAXBUF);
c.registration_timeout = 90; // default is 2 minutes
+ c.pingtime = 120;
c.flood = atoi(flood);
if (atoi(timeout)>0)
{
c.registration_timeout = atoi(timeout);
}
+ if (atoi(pfreq)>0)
+ {
+ c.pingtime = atoi(pfreq);
+ }
Classes.push_back(c);
log(DEBUG,"Read connect class type ALLOW, host=%s password=%s timeout=%d flood=%d",c.host,c.pass,c.registration_timeout,c.flood);
}
@@ -2287,7 +2293,6 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip)
strncpy(clientlist[tempnick]->ident, "unknown",9);
clientlist[tempnick]->registered = 0;
clientlist[tempnick]->signon = TIME+dns_timeout;
- clientlist[tempnick]->nping = TIME+240+dns_timeout;
clientlist[tempnick]->lastping = 1;
clientlist[tempnick]->port = port;
strncpy(clientlist[tempnick]->ip,ip,32);
@@ -2302,10 +2307,12 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip)
{
class_regtimeout = (unsigned long)i->registration_timeout;
class_flood = i->flood;
+ clientlist[tempnick]->pingmax = i->pingtime;
break;
}
}
+ clientlist[tempnick]->nping = TIME+clientlist[tempnick]->pingmax+dns_timeout;
clientlist[tempnick]->timeout = TIME+class_regtimeout;
clientlist[tempnick]->flood = class_flood;
@@ -2922,7 +2929,7 @@ void process_command(userrec *user, char* cmd)
log(DEBUG,"Processing command");
/* activity resets the ping pending timer */
- user->nping = TIME + 120;
+ user->nping = TIME + user->pingmax;
if ((items) < cmdlist[i].min_params)
{
log(DEBUG,"process_command: not enough parameters: %s %s",user->nick,command);
@@ -3842,7 +3849,7 @@ int InspIRCd(void)
Write(count2->second->fd,"PING :%s",ServerName);
log(DEBUG,"InspIRCd: pinging: %s",count2->second->nick);
count2->second->lastping = 0;
- count2->second->nping = TIME+120;
+ count2->second->nping = TIME+count2->second->pingmax; // was hard coded to 120
}
}
count2++;