mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
exempt a configurable number of MARKREAD commands from fakelag
This commit is contained in:
parent
7d6ff58bf8
commit
7ad31497c2
6 changed files with 59 additions and 12 deletions
|
|
@ -668,12 +668,21 @@ func (client *Client) run(session *Session) {
|
|||
}
|
||||
}
|
||||
|
||||
msg, err := ircmsg.ParseLineStrict(line, true, MaxLineLen)
|
||||
// XXX defer processing of command error parsing until after fakelag
|
||||
|
||||
if client.registered {
|
||||
touches := session.deferredFakelagCount + 1
|
||||
session.deferredFakelagCount = 0
|
||||
for i := 0; i < touches; i++ {
|
||||
session.fakelag.Touch()
|
||||
// apply deferred fakelag
|
||||
for i := 0; i < session.deferredFakelagCount; i++ {
|
||||
session.fakelag.Touch("")
|
||||
}
|
||||
session.deferredFakelagCount = 0
|
||||
// touch for the current command
|
||||
var command string
|
||||
if err == nil {
|
||||
command = msg.Command
|
||||
}
|
||||
session.fakelag.Touch(command)
|
||||
} else {
|
||||
// DoS hardening, #505
|
||||
session.registrationMessages++
|
||||
|
|
@ -683,7 +692,6 @@ func (client *Client) run(session *Session) {
|
|||
}
|
||||
}
|
||||
|
||||
msg, err := ircmsg.ParseLineStrict(line, true, MaxLineLen)
|
||||
if err == ircmsg.ErrorLineIsEmpty {
|
||||
continue
|
||||
} else if err == ircmsg.ErrorTagsTooLong {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue