erc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Erc-commit] [commit][emacs22] Fix bug where reconnect was not happening


From: mwolson
Subject: [Erc-commit] [commit][emacs22] Fix bug where reconnect was not happening when erc-server-reconnect-attempts was t
Date: Sun, 14 Oct 2007 00:49:07 -0400

commit 7e78c9918ff40b5a17c517976fc807db4d1534e7
Author: Michael W. Olson <address@hidden>
Date:   Mon Aug 13 23:59:26 2007 -0400

    Fix bug where reconnect was not happening when 
erc-server-reconnect-attempts was t
    
    * erc-backend.el (erc-process-sentinel-1): Fix bug where reconnect was
      not happening when erc-server-reconnect-attempts was t.  Call
      erc-server-reconnect-p only once per loop iteration.

diff --git a/ChangeLog b/ChangeLog
index b0dce79..38cfe66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,7 +7,9 @@
        been deleted.  Thanks to jbms for the report.
        (erc-process-sentinel-1): Take server buffer as an argument, so
        that we can make sure that it is current.  If it is deleted during
-       a reconnect attempt, stop trying to reconnect.
+       a reconnect attempt, stop trying to reconnect.  Fix bug where
+       reconnect was not happening when erc-server-reconnect-attempts was
+       t.  Call erc-server-reconnect-p only once per loop iteration.
        (erc-process-sentinel): Pass buffer to erc-process-sentinel-1.
 
        * erc.el (erc-command-no-process-p): Fix bug: the return value of
diff --git a/erc-backend.el b/erc-backend.el
index 463bffa..9e5279e 100644
--- a/erc-backend.el
+++ b/erc-backend.el
@@ -623,14 +623,15 @@ Conditionally try to reconnect and take appropriate 
action."
             (set-buffer-modified-p nil)
             (kill-buffer (current-buffer))))
       ;; unexpected disconnect
-      (let ((again t))
+      (let ((again t)
+            reconnect-p)
         (while again
           (setq again nil)
+          (setq reconnect-p (erc-server-reconnect-p event))
           (erc-display-message nil 'error (current-buffer)
-                               (if (erc-server-reconnect-p event)
-                                   'disconnected
+                               (if reconnect-p 'disconnected
                                  'disconnected-noreconnect))
-          (if (erc-server-reconnect-p event)
+          (if reconnect-p
               (condition-case err
                   (progn
                     (setq erc-server-reconnecting nil)
@@ -640,9 +641,11 @@ Conditionally try to reconnect and take appropriate 
action."
                          (set-buffer buffer)
                          (when (integerp erc-server-reconnect-attempts)
                            (setq erc-server-reconnect-count
-                                 (1+ erc-server-reconnect-count))
-                           (sit-for erc-server-reconnect-timeout)
-                           (setq again t)))))
+                                 (1+ erc-server-reconnect-count)))
+                         ;; TODO: Make this use a one-time timer
+                         ;; instead of sit-for
+                         (sit-for erc-server-reconnect-timeout)
+                         (setq again t))))
             ;; terminate, do not reconnect
             (erc-display-message nil 'error (current-buffer)
                                  'terminated ?e event)))))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]