From 05459012ef3401b054d59dd6c1e274ce9e13b1f4 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Wed, 22 May 2019 18:35:24 -0400 Subject: [PATCH] move fakelag processing back to read loop as well --- irc/client.go | 6 ++++-- irc/commands.go | 4 ---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/irc/client.go b/irc/client.go index 4f4f4cb0..59d06f3e 100644 --- a/irc/client.go +++ b/irc/client.go @@ -398,8 +398,10 @@ func (client *Client) run(session *Session) { } } - // DoS hardening, #505 - if !client.registered { + if client.registered { + session.fakelag.Touch() + } else { + // DoS hardening, #505 session.registrationMessages++ if client.server.Config().Limits.RegistrationMessages < session.registrationMessages { client.Send(nil, client.server.name, ERR_UNKNOWNERROR, "*", client.t("You have sent too many registration messages")) diff --git a/irc/commands.go b/irc/commands.go index c7e16b2b..38d50c66 100644 --- a/irc/commands.go +++ b/irc/commands.go @@ -39,10 +39,6 @@ func (cmd *Command) Run(server *Server, client *Client, session *Session, msg ir return false } - if client.registered { - session.fakelag.Touch() - } - rb := NewResponseBuffer(session) rb.Label = GetLabel(msg) exiting := cmd.handler(server, client, msg, rb)