GNU bug report logs - #19292
24.3; [PATCH] erc-server-ping-timer-alist now has at most one timer per buffer

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Sat, 6 Dec 2014 22:50:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 24.3

Fixed in version 25.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19292 in the body.
You can then email your comments to 19292 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#19292; Package emacs. (Sat, 06 Dec 2014 22:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dima Kogan <dima <at> secretsauce.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Dec 2014 22:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <dima <at> secretsauce.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3;
 [PATCH] erc-server-ping-timer-alist now has at most one timer per
 buffer
Date: Sat, 06 Dec 2014 14:49:13 -0800
[Message part 1 (text/plain, inline)]
This alist was meant to map buffers to timers, but the "push" function
was not checking for already-existing timers.  This was causing a
flood of PINGs being queued (because more than one timer was inserting
those), and the flood-control logic would block those from going
through quickly.

This patch checks for existing timers in the alist before adding new
ones.  If a timer already exists, it is cancelled and overwritten.

[0001-erc-server-ping-timer-alist-now-has-at-most-one-time.patch (text/x-diff, inline)]
From 421c00345c3407fff7044092c458316c6da870a6 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima <at> secretsauce.net>
Date: Sat, 6 Dec 2014 14:46:51 -0800
Subject: [PATCH] erc-server-ping-timer-alist now has at most one timer per
 buffer

This alist was meant to map buffers to timers, but the "push" function
was not checking for already-existing timers.  This was causing a
flood of PINGs being queued (because more than one timer was inserting
those), and the flood-control logic would block those from going
through quickly.

This patch checks for existing timers in the alist before adding new
ones.  If a timer already exists, it is cancelled and overwritten.
---
 lisp/erc/erc-backend.el | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index fb22f58..bedb20f 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -493,9 +493,19 @@ The current buffer is given by BUFFER."
                                      4 erc-server-send-ping-interval
                                      #'erc-server-send-ping
                                      buffer))
-      (setq erc-server-ping-timer-alist (cons (cons buffer
-                                                    erc-server-ping-handler)
-                                              erc-server-ping-timer-alist)))))
+
+      ;; I check the timer alist for an existing timer. If one exists,
+      ;; I get rid of it
+      (let ((timer-tuple (assq buffer erc-server-ping-timer-alist)))
+        (if timer-tuple
+            ;; this buffer already has a timer. Cancel it and set the new one
+            (progn
+              (erc-cancel-timer (cdr timer-tuple))
+              (setf (cdr (assq buffer erc-server-ping-timer-alist)) erc-server-ping-handler))
+
+          ;; no existing timer for this buffer. Add new one
+          (add-to-list 'erc-server-ping-timer-alist
+                       (cons buffer erc-server-ping-handler)))))))
 
 (defun erc-server-process-alive (&optional buffer)
   "Return non-nil when BUFFER has an `erc-server-process' open or running."
-- 
2.0.0


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19292; Package emacs. (Sun, 15 Feb 2015 20:05:02 GMT) Full text and rfc822 format available.

Message #8 received at 19292 <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <dima <at> secretsauce.net>
To: 19292 <at> debbugs.gnu.org
Subject: Re: 24.3;
 [PATCH] erc-server-ping-timer-alist now has at most one timer per
 buffer
Date: Sun, 15 Feb 2015 12:03:01 -0800
Hi. This is a gentle ping. The attached patch made ERC usable for me,
and it would be great if it was merged. The added code is simply a
safety check.

Thanks




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19292; Package emacs. (Sun, 27 Dec 2015 20:21:02 GMT) Full text and rfc822 format available.

Message #11 received at 19292 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 19292 <at> debbugs.gnu.org
Subject: Re: bug#19292: 24.3;
 [PATCH] erc-server-ping-timer-alist now has at most one timer per
 buffer
Date: Sun, 27 Dec 2015 21:19:49 +0100
Dima Kogan <dima <at> secretsauce.net> writes:

> This alist was meant to map buffers to timers, but the "push" function
> was not checking for already-existing timers.  This was causing a
> flood of PINGs being queued (because more than one timer was inserting
> those), and the flood-control logic would block those from going
> through quickly.
>
> This patch checks for existing timers in the alist before adding new
> ones.  If a timer already exists, it is cancelled and overwritten.

Thanks; applied to Emacs 25.1.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 27 Dec 2015 20:21:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.1, send any further explanations to 19292 <at> debbugs.gnu.org and Dima Kogan <dima <at> secretsauce.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 27 Dec 2015 20:21:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 25 Jan 2016 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 146 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.