1
0
forked from bip/bip

Fix endless loop on /BIP LIST connections with long on_connect_send

- when the line to send to IRC was over a specific limit, the code was
  not moving to the next item in the on_connect_send list after sending
  the text to the client
- this change also adds a hard limit of 10 on_connect_send to display
  for each connection

Signed-off-by: Loïc Gomez <bip@animanova.fr>
This commit is contained in:
Loïc Gomez 2024-02-04 23:24:29 +09:00
parent 8f3b313776
commit e643cd4944
Signed by: Kyoshiro
GPG Key ID: F80C2F71E89B990A

View File

@ -1396,9 +1396,10 @@ void adm_print_connection(struct link_client *ic, struct link *lnk,
bufpos = buf;
list_iterator_t itocs;
int i = 0;
for (list_it_init(&lnk->on_connect_send, &itocs);
list_it_item(&itocs);) {
bufpos = bip_strcatf_fit(&remaining, bufpos, "%s",
list_it_item(&itocs) && i < 10; i++) {
bufpos = bip_strcatf_fit(&remaining, bufpos, " on_connect_send: %s",
(char *)list_it_item(&itocs));
if (!bufpos) {
// if oversized, print and reset
@ -1406,6 +1407,7 @@ void adm_print_connection(struct link_client *ic, struct link *lnk,
bip_notify(ic, "%s", buf);
remaining = LINE_SIZE_LIM;
bufpos = buf;
list_it_next(&itocs);
continue;
} else {
// if ok, go to next item