1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 14:43:13 +02:00

Quicker handshake when using many CAP requests and/or AUTHENTICATE.

I was wondering why the handshake took 4 seconds for a client which
authenticates using SASL. Turns out that fake lag was kicking in due
to the many "CAP req" commands combined with the other handshake stuff.
Now the first 15 (or so) "CAP" requests are "free", without fake lag.
This commit is contained in:
Bram Matthys
2019-02-09 16:47:24 +01:00
parent 78cd122a05
commit c7f00edd9d
+8 -1
View File
@@ -42,7 +42,7 @@ MOD_INIT(m_cap)
ClientCapability c;
MARK_AS_OFFICIAL_MODULE(modinfo);
CommandAdd(modinfo->handle, MSG_CAP, m_cap, MAXPARA, M_UNREGISTERED|M_USER);
CommandAdd(modinfo->handle, MSG_CAP, m_cap, MAXPARA, M_UNREGISTERED|M_USER|M_NOLAG);
memset(&c, 0, sizeof(c));
c.name = "account-notify";
@@ -354,6 +354,13 @@ CMD_FUNC(m_cap)
{
struct clicap_cmd *cmd;
/* CAP is marked as "no fake lag" because we use custom fake lag rules:
* Only add a 1 second fake lag penalty if this is the XXth command.
* This will speed up connections considerably.
*/
if (MyConnect(sptr) && (sptr->local->receiveM > 15))
cptr->local->since++;
if (DISABLE_CAP)
{
/* I know nothing! */