mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-05 20:13:12 +02:00
- Improved fake lag stuff
This commit is contained in:
@@ -1967,3 +1967,4 @@ seen. gmtime warning still there
|
||||
- Fixed a /who big which could make the server crash (oper only).
|
||||
- Fixed a match() bug
|
||||
- Fixed a /version bug
|
||||
- Improved fake lag stuff
|
||||
|
||||
+22
-17
@@ -174,6 +174,22 @@ void ban_flooder(aClient *cptr)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine adds fake lag if needed.
|
||||
*/
|
||||
inline void parse_addlag(aClient *cptr, int cmdbytes)
|
||||
{
|
||||
if (!IsServer(cptr) &&
|
||||
#ifdef FAKE_LAG_FOR_LOCOPS
|
||||
!IsAnOper(cptr))
|
||||
#else
|
||||
!IsOper(cptr))
|
||||
#endif
|
||||
{
|
||||
cptr->since += (1 + cmdbytes/90);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* parse a buffer.
|
||||
*
|
||||
@@ -312,6 +328,7 @@ int parse(aClient *cptr, char *buffer, char *bufend)
|
||||
else
|
||||
{
|
||||
int flags = 0;
|
||||
int bytes = bufend - ch;
|
||||
if (s)
|
||||
*s++ = '\0';
|
||||
if (!IsRegistered(from))
|
||||
@@ -341,6 +358,7 @@ int parse(aClient *cptr, char *buffer, char *bufend)
|
||||
if (!IsRegistered(cptr) && stricmp(ch, "NOTICE")) {
|
||||
sendto_one(from, ":%s %d %s :You have not registered",
|
||||
me.name, ERR_NOTREGISTERED, ch);
|
||||
parse_addlag(cptr, bytes);
|
||||
return -1;
|
||||
}
|
||||
if (IsShunned(cptr))
|
||||
@@ -355,6 +373,7 @@ int parse(aClient *cptr, char *buffer, char *bufend)
|
||||
from->name, ch);
|
||||
Debug((DEBUG_ERROR, "Unknown (%s) from %s",
|
||||
ch, get_client_name(cptr, TRUE)));
|
||||
parse_addlag(cptr, bytes);
|
||||
}
|
||||
ircstp->is_unco++;
|
||||
return (-1);
|
||||
@@ -370,23 +389,9 @@ int parse(aClient *cptr, char *buffer, char *bufend)
|
||||
return -1;
|
||||
}
|
||||
paramcount = cmptr->parameters;
|
||||
i = bufend - ch; /* Is this right? -Donwulff */
|
||||
cmptr->bytes += i;
|
||||
/* Changed this whole lag generating crap ..
|
||||
* We only generate fake lag in HTM ..
|
||||
* --Stskeeps
|
||||
*/
|
||||
if (!IsServer(cptr) &&
|
||||
#ifdef FAKE_LAG_FOR_LOCOPS
|
||||
!IsAnOper(cptr)
|
||||
#else
|
||||
!IsOper(cptr)
|
||||
#endif
|
||||
&& !(cmptr->flags & M_NOLAG))
|
||||
{
|
||||
cptr->since += (1 + i /90);
|
||||
|
||||
}
|
||||
cmptr->bytes += bytes;
|
||||
if (!(cmptr->flags & M_NOLAG))
|
||||
parse_addlag(cptr, bytes);
|
||||
}
|
||||
/*
|
||||
** Must the following loop really be so devious? On
|
||||
|
||||
Reference in New Issue
Block a user