[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix ERC automatic re-connection behavior...
From: |
Victor J. Orlikowski |
Subject: |
[PATCH] Fix ERC automatic re-connection behavior... |
Date: |
Thu, 30 Mar 2017 15:38:41 -0400 |
User-agent: |
Notmuch/0.22.2 (http://notmuchmail.org) Emacs/25.1.1 (x86_64-apple-darwin15.6.0) |
The existing code to handle automatic re-connection in ERC only runs
once, then exits. The following patch ensures that re-connection
behavior functions as-documented.
>From 21cde8f74d61d0e30f37f74b6d4084f3159dfdcd Mon Sep 17 00:00:00 2001
From: "Victor J. Orlikowski" <address@hidden>
Date: Thu, 30 Mar 2017 13:12:55 -0400
Subject: [PATCH 1/2] Fix auto-reconnect to work properly again.
---
lisp/erc/erc-backend.el | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 8eac2e1..b30c484 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -607,10 +607,20 @@ Make sure you are in an ERC buffer when running this."
(erc-open erc-session-server erc-session-port erc-server-current-nick
erc-session-user-full-name t erc-session-password)))))
-(defun erc-server-delayed-reconnect (buffer)
- (if (buffer-live-p buffer)
- (with-current-buffer buffer
- (erc-server-reconnect))))
+(defun erc-server-background-reconnect (buffer)
+ (condition-case err
+ (progn
+ (setq erc-server-reconnecting nil
+ erc-server-reconnect-count (1+ erc-server-reconnect-count))
+ (if (buffer-live-p buffer)
+ (with-current-buffer buffer
+ (erc-server-reconnect))))
+ (error (unless (integerp erc-server-reconnect-attempts)
+ (message "%s ... %s"
+ "Reconnecting until we succeed"
+ "kill the ERC server buffer to stop"))
+ (run-at-time erc-server-reconnect-timeout nil
+ #'erc-server-background-reconnect buffer))))
(defun erc-server-filter-function (process string)
"The process filter for the ERC server."
@@ -676,18 +686,8 @@ EVENT is the message received from the closed connection
process."
(erc-update-mode-line)
(set-buffer-modified-p nil))
;; reconnect
- (condition-case nil
- (progn
- (setq erc-server-reconnecting nil
- erc-server-reconnect-count (1+
erc-server-reconnect-count))
- (setq delay erc-server-reconnect-timeout)
- (run-at-time delay nil
- #'erc-server-delayed-reconnect buffer))
- (error (unless (integerp erc-server-reconnect-attempts)
- (message "%s ... %s"
- "Reconnecting until we succeed"
- "kill the ERC server buffer to stop"))
- (erc-server-delayed-reconnect buffer))))))))
+ (run-at-time nil nil
+ #'erc-server-background-reconnect buffer))))))
(defun erc-process-sentinel-1 (event buffer)
"Called when `erc-process-sentinel' has decided that we're disconnecting.
--
2.10.1 (Apple Git-78)
Best,
Victor
--
Victor J. Orlikowski <> address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Fix ERC automatic re-connection behavior...,
Victor J. Orlikowski <=