[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Erc-commit] [commit][emacs22] Merge new reconnect algorithm from flerde
From: |
mwolson |
Subject: |
[Erc-commit] [commit][emacs22] Merge new reconnect algorithm from flerdermaus |
Date: |
Sun, 14 Oct 2007 00:48:46 -0400 |
commit 74bed72cd5911699a00cd9cb34080e8a716af667
Author: Michael Olson <address@hidden>
Date: Thu Feb 15 00:21:10 2007 +0000
Merge new reconnect algorithm from flerdermaus
2007-02-15 Vivek Dasmohapatra <address@hidden>
* erc.el (erc-cmd-RECONNECT): Kill old process if it is still
alive.
(erc-message-english-PART): Properly escape "%" characters in
reason.
* erc-backend.el (erc-server-reconnecting): New variable that is
set when the user requests a reconnect, but the old process is
still alive. This forces the reconnect to work even though the
process is killed manually during reconnect.
(erc-server-connect): Initialize it.
(erc-server-reconnect-p): Use it.
(erc-process-sentinel-1): Set it to nil after the first reconnect
attempt.
git-archimport-id: address@hidden/erc--main--0--patch-104
diff --git a/ChangeLog b/ChangeLog
index 26def0d..8cba67c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2007-02-15 Vivek Dasmohapatra <address@hidden>
+
+ * erc.el (erc-cmd-RECONNECT): Kill old process if it is still
+ alive.
+ (erc-message-english-PART): Properly escape "%" characters in
+ reason.
+
+ * erc-backend.el (erc-server-reconnecting): New variable that is
+ set when the user requests a reconnect, but the old process is
+ still alive. This forces the reconnect to work even though the
+ process is killed manually during reconnect.
+ (erc-server-connect): Initialize it.
+ (erc-server-reconnect-p): Use it.
+ (erc-process-sentinel-1): Set it to nil after the first reconnect
+ attempt.
+
2007-02-07 Diane Murray <address@hidden>
* erc-menu.el (erc-menu-definition): Fixed so that the separator
diff --git a/erc-backend.el b/erc-backend.el
index 8d33459..713f713 100644
--- a/erc-backend.el
+++ b/erc-backend.el
@@ -193,6 +193,11 @@ active, use the `erc-server-process-alive' function
instead.")
"Non-nil if the user requests a quit.")
(make-variable-buffer-local 'erc-server-quitting)
+(defvar erc-server-reconnecting nil
+ "Non-nil if the user requests an explicit reconnect, and the
+current IRC process is still alive.")
+(make-variable-buffer-local 'erc-server-reconnecting)
+
(defvar erc-server-timed-out nil
"Non-nil if the IRC server failed to respond to a ping.")
(make-variable-buffer-local 'erc-server-timed-out)
@@ -497,6 +502,7 @@ We will store server variables in the buffer given by
BUFFER."
(with-current-buffer buffer
(setq erc-server-process process)
(setq erc-server-quitting nil)
+ (setq erc-server-reconnecting nil)
(setq erc-server-timed-out nil)
(setq erc-server-banned nil)
(setq erc-server-error-occurred nil)
@@ -573,18 +579,20 @@ Make sure you are in an ERC buffer when running this."
(defsubst erc-server-reconnect-p (event)
"Return non-nil if ERC should attempt to reconnect automatically.
EVENT is the message received from the closed connection process."
- (and erc-server-auto-reconnect
- (not erc-server-banned)
- (not erc-server-error-occurred)
- ;; make sure we don't infinitely try to reconnect, unless the
- ;; user wants that
- (or (eq erc-server-reconnect-attempts t)
- (and (integerp erc-server-reconnect-attempts)
- (< erc-server-reconnect-count erc-server-reconnect-attempts)))
- (or erc-server-timed-out
- (not (string-match "^deleted" event)))
- ;; open-network-stream-nowait error for connection refused
- (not (string-match "^failed with code 111" event))))
+ (or erc-server-reconnecting
+ (and erc-server-auto-reconnect
+ (not erc-server-banned)
+ (not erc-server-error-occurred)
+ ;; make sure we don't infinitely try to reconnect, unless the
+ ;; user wants that
+ (or (eq erc-server-reconnect-attempts t)
+ (and (integerp erc-server-reconnect-attempts)
+ (< erc-server-reconnect-count
+ erc-server-reconnect-attempts)))
+ (or erc-server-timed-out
+ (not (string-match "^deleted" event)))
+ ;; open-network-stream-nowait error for connection refused
+ (not (string-match "^failed with code 111" event)))))
(defun erc-process-sentinel-1 (event)
"Called when `erc-process-sentinel' has decided that we're disconnecting.
@@ -608,6 +616,7 @@ Conditionally try to reconnect and take appropriate action."
(if (erc-server-reconnect-p event)
(condition-case err
(progn
+ (setq erc-server-reconnecting nil)
(erc-server-reconnect)
(setq erc-server-reconnect-count 0))
(error (when (integerp erc-server-reconnect-attempts)
diff --git a/erc.el b/erc.el
index 9721839..ea65494 100644
--- a/erc.el
+++ b/erc.el
@@ -3204,8 +3204,17 @@ the message given by REASON."
(defun erc-cmd-RECONNECT ()
"Try to reconnect to the current IRC server."
- (setq erc-server-reconnect-count 0)
- (erc-server-reconnect)
+ (let ((buffer (or (erc-server-buffer) (current-buffer)))
+ (process nil))
+ (with-current-buffer (if (bufferp buffer) buffer (current-buffer))
+ (setq erc-server-quitting nil)
+ (setq erc-server-reconnecting t)
+ (setq erc-server-reconnect-count 0)
+ (setq process (get-buffer-process (erc-server-buffer)))
+ (if process
+ (delete-process process)
+ (erc-server-reconnect))
+ (setq erc-server-reconnecting nil)))
t)
(defun erc-cmd-SERVER (server)
@@ -6150,7 +6159,8 @@ functions."
(format "%s (address@hidden) has left channel %s%s"
nick user host channel
(if (not (string= reason ""))
- (format ": %s" reason)
+ (format ": %s"
+ (erc-replace-regexp-in-string "%" "%%" reason))
"")))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Erc-commit] [commit][emacs22] Merge new reconnect algorithm from flerdermaus,
mwolson <=