all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thomas Riccardi <riccardi.thomas@gmail.com>
To: 5650@debbugs.gnu.org
Subject: bug#5650: Issue with the patch
Date: Sun, 25 Apr 2010 22:39:14 +0200	[thread overview]
Message-ID: <1272227954.9935.39.camel@kiwi-pc2> (raw)
In-Reply-To: <87wry1x9k2.wl%richard.lewis@gold.ac.uk>

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

The patch works for me (even if there is still a small freeze during
about 1 second at the connection if the server doesn't answer), but
creates an issue with the auto reconnect feature.

It happens when the server doesn't answer the connection request (tested
with a DROP on packets coming from it with iptables).

The patch makes the function erc-server-connect to return even if the
connection is not ready. Then erc-open and erc-server-reconnect do the
same.

Finally, in erc-process-sentinel-2, there is no error executing
erc-server-reconnect, thus erc-server-reconnect-count is never
incremented and is even reset.

I made a patch that increments erc-server-reconnect-count before calling
erc-server-reconnect instead, and resets it only when the connection is
really ready, that is, in erc-connection-established.

[-- Attachment #2: Fix-reconnect-attempts-count.patch --]
[-- Type: text/x-patch, Size: 1630 bytes --]

diff --git a/.emacs.d/erc-5.3/erc-backend.el b/.emacs.d/erc-5.3/erc-backend.el
index 70ce789..928770e 100644
--- a/.emacs.d/erc-5.3/erc-backend.el
+++ b/.emacs.d/erc-5.3/erc-backend.el
@@ -618,13 +618,11 @@ EVENT is the message received from the closed connection process."
           (condition-case err
               (progn
                 (setq erc-server-reconnecting nil)
-                (erc-server-reconnect)
-                (setq erc-server-reconnect-count 0))
+                (setq erc-server-reconnect-count (1+ erc-server-reconnect-count))
+                (erc-server-reconnect))
             (error (when (buffer-live-p buffer)
                      (set-buffer buffer)
-                     (if (integerp erc-server-reconnect-attempts)
-                         (setq erc-server-reconnect-count
-                               (1+ erc-server-reconnect-count))
+                     (unless (integerp erc-server-reconnect-attempts)
                        (message "%s ... %s"
                                 "Reconnecting until we succeed"
                                 "kill the ERC server buffer to stop"))
diff --git a/.emacs.d/erc-5.3/erc.el b/.emacs.d/erc-5.3/erc.el
index 9aa5e8b..802ae66 100644
--- a/.emacs.d/erc-5.3/erc.el
+++ b/.emacs.d/erc-5.3/erc.el
@@ -4267,6 +4267,7 @@ Set user modes and run `erc-after-connect' hook."
 	    (nick (car (erc-response.command-args parsed)))
 	    (buffer (process-buffer proc)))
 	(setq erc-server-connected t)
+	(setq erc-server-reconnect-count 0)
 	(erc-update-mode-line)
 	(erc-set-initial-user-mode nick buffer)
 	(erc-server-setup-periodical-ping buffer)

  parent reply	other threads:[~2010-04-25 20:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-25 21:57 bug#5650: 23.1; ERC causes Emacs to hang on network dropouts Richard Lewis
2010-02-26 23:49 ` bug#5650: Proposed fix Vivek Dasmohapatra
2010-03-04 13:58 ` bug#5650: Oops, bad patch Vivek Dasmohapatra
2010-03-08 23:29 ` bug#5650: updated patch Vivek Dasmohapatra
2015-12-27 22:17   ` Lars Ingebrigtsen
2010-04-25 20:39 ` Thomas Riccardi [this message]
2015-12-27 22:17   ` bug#5650: Issue with the patch Lars Ingebrigtsen
2010-08-14 23:05 ` bug#5650: 23.1; ERC causes Emacs to hang on network dropouts Chong Yidong
2013-02-06  0:06 ` bug#5650: Status Michael McCracken
     [not found] ` <87fwyg7q23.fsf@stupidchicken.com>
2015-12-27 22:16   ` bug#5650: 23.1; ERC causes Emacs to hang on network dropouts Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1272227954.9935.39.camel@kiwi-pc2 \
    --to=riccardi.thomas@gmail.com \
    --cc=5650@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.