* bug#72456: [PATCH] rcirc: Fix startup channels triggering flood protection
@ 2024-08-04 0:00 Thuna
2024-08-04 14:55 ` Philip Kaludercic
0 siblings, 1 reply; 3+ messages in thread
From: Thuna @ 2024-08-04 0:00 UTC (permalink / raw)
To: 72456; +Cc: philipk
[-- Attachment #1: Type: text/plain, Size: 737 bytes --]
If too many channels are set up to be joined on startup, all of their
JOIN messages are sent at once, possibly triggering the flood protection
of the server and causing the link to be forcefully severed. (In libera
I hit this limit with 12 channels - not a lot, all things considered.)
This patch mitigates this by sending a single JOIN message with all the
channels joined with ",".
This has a flaw, which is mentioned in the patch in a FIXME, in that if
the total length of the channels exceeds the maximum length of a message
then the message will likely split and break. While checking for it
while joining the channel names is a possibility, it's probably better
if we split command messages more elegantly in the first place.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: text/x-patch --]
[-- Type: text/x-patch, Size: 965 bytes --]
From 9c205cfe46679f17f5e8cf8b4c2999e50eb97adb Mon Sep 17 00:00:00 2001
From: Thuna <thuna.cing@gmail.com>
Date: Fri, 22 Mar 2024 14:58:03 +0100
Subject: [PATCH] [WIP] rcirc fix startup channels flooding the server
---
lisp/net/rcirc.el | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 6e71085808a..a3912ac4047 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -2265,9 +2265,9 @@ rcirc-join-channels
"Join CHANNELS.
PROCESS is the process object for the current connection."
(save-window-excursion
- (dolist (channel channels)
- (with-rcirc-process-buffer process
- (rcirc-cmd-join channel process)))))
+ (with-rcirc-process-buffer process
+ ;; FIXME: Handle the situation where the full message is too long
+ (rcirc-cmd-join (string-join channels ",") process))))
\f
;;; nick management
(defvar rcirc-nick-prefix-chars '(?~ ?& ?@ ?% ?+)
--
2.44.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#72456: [PATCH] rcirc: Fix startup channels triggering flood protection
2024-08-04 0:00 bug#72456: [PATCH] rcirc: Fix startup channels triggering flood protection Thuna
@ 2024-08-04 14:55 ` Philip Kaludercic
2024-08-06 18:23 ` Thuna
0 siblings, 1 reply; 3+ messages in thread
From: Philip Kaludercic @ 2024-08-04 14:55 UTC (permalink / raw)
To: Thuna; +Cc: 72456
Thuna <thuna.cing@gmail.com> writes:
> If too many channels are set up to be joined on startup, all of their
> JOIN messages are sent at once, possibly triggering the flood protection
> of the server and causing the link to be forcefully severed. (In libera
> I hit this limit with 12 channels - not a lot, all things considered.)
>
> This patch mitigates this by sending a single JOIN message with all the
> channels joined with ",".
>
> This has a flaw, which is mentioned in the patch in a FIXME, in that if
> the total length of the channels exceeds the maximum length of a message
> then the message will likely split and break. While checking for it
> while joining the channel names is a possibility, it's probably better
> if we split command messages more elegantly in the first place.
I think we should fix that before applying the change, as I cannot
imagine that the error message in that case will be in any way helpful.
> From 9c205cfe46679f17f5e8cf8b4c2999e50eb97adb Mon Sep 17 00:00:00 2001
> From: Thuna <thuna.cing@gmail.com>
> Date: Fri, 22 Mar 2024 14:58:03 +0100
> Subject: [PATCH] [WIP] rcirc fix startup channels flooding the server
>
> ---
> lisp/net/rcirc.el | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
> index 6e71085808a..a3912ac4047 100644
> --- a/lisp/net/rcirc.el
> +++ b/lisp/net/rcirc.el
> @@ -2265,9 +2265,9 @@ rcirc-join-channels
> "Join CHANNELS.
> PROCESS is the process object for the current connection."
> (save-window-excursion
> - (dolist (channel channels)
> - (with-rcirc-process-buffer process
> - (rcirc-cmd-join channel process)))))
> + (with-rcirc-process-buffer process
> + ;; FIXME: Handle the situation where the full message is too long
> + (rcirc-cmd-join (string-join channels ",") process))))
> \f
> ;;; nick management
> (defvar rcirc-nick-prefix-chars '(?~ ?& ?@ ?% ?+)
--
Philip Kaludercic on peregrine
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#72456: [PATCH] rcirc: Fix startup channels triggering flood protection
2024-08-04 14:55 ` Philip Kaludercic
@ 2024-08-06 18:23 ` Thuna
0 siblings, 0 replies; 3+ messages in thread
From: Thuna @ 2024-08-06 18:23 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: 72456
>> This has a flaw, which is mentioned in the patch in a FIXME, in that if
>> the total length of the channels exceeds the maximum length of a message
>> then the message will likely split and break. While checking for it
>> while joining the channel names is a possibility, it's probably better
>> if we split command messages more elegantly in the first place.
>
> I think we should fix that before applying the change, as I cannot
> imagine that the error message in that case will be in any way helpful.
Actually, oddly enough, no matter how long I made my JOIN message I was
able to send it and have it actually work.
I did a hundred channels on tilde.chat which all joined with:
(cl-loop initially (insert "/join ")
for i from 0 to 100
do (insert "#"
(apply #'string
(mapcar (lambda (c) (+ c (- ?a ?0)))
(append (format "%04d" i) nil)))
",")
finally (delete-char -1))
and I did a
/join #aaaaaaaaaa,#aaaaaaaaaa,...
in libera.chat with the full message more than 3400 characters long.
They both seemed to work as you would hope.
It would be nice if you could verify that this is the case and
furthermore that this is the case in other servers as well. If this is
something that can be relied on then we might not need to be concerned
with the total message length after all.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-06 18:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-04 0:00 bug#72456: [PATCH] rcirc: Fix startup channels triggering flood protection Thuna
2024-08-04 14:55 ` Philip Kaludercic
2024-08-06 18:23 ` Thuna
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.