erc-commit
[Top][All Lists]
Advanced

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

[Erc-commit] [commit][emacs22] If the connection times out, try to recon


From: mwolson
Subject: [Erc-commit] [commit][emacs22] If the connection times out, try to reconnect if the user wants it.
Date: Sun, 14 Oct 2007 00:48:25 -0400

commit 2e4f32343c07619bdac5858d5f809732e2ce3b41
Author: Michael Olson <address@hidden>
Date:   Sun Aug 13 22:36:06 2006 +0000

    If the connection times out, try to reconnect if the user wants it.
    
    * erc-backend.el (erc-server-timed-out): New variable that indicates
      whether the current connection has timed out due to failure to respond
      to a ping.
      (erc-server-send-ping): Set erc-server-timed-out to t.
      (erc-server-connect): Initialize erc-server-timed-out to nil.
      (erc-process-sentinel-1): Consult erc-server-timed-out.
    git-archimport-id: address@hidden/erc--main--0--patch-40

diff --git a/ChangeLog b/ChangeLog
index 38af6c3..c9b852a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-08-13  Michael Olson  <address@hidden>
+
+       * erc-backend.el (erc-server-timed-out): New variable that
+       indicates whether the current connection has timed out due to
+       failure to respond to a ping.
+       (erc-server-send-ping): Set erc-server-timed-out to t.
+       (erc-server-connect): Initialize erc-server-timed-out to nil.
+       (erc-process-sentinel-1): Consult erc-server-timed-out.
+
 2006-08-11  Michael Olson  <address@hidden>
 
        * erc-fill.el (erc-fill): Skip any initial empty lines so that we
diff --git a/erc-backend.el b/erc-backend.el
index abee916..aeb8d69 100644
--- a/erc-backend.el
+++ b/erc-backend.el
@@ -186,6 +186,10 @@ This variable is buffer-local.")
   "Non-nil if the user requests a quit.")
 (make-variable-buffer-local 'erc-server-quitting)
 
+(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)
+
 (defvar erc-server-lines-sent nil
   "Line counter.")
 (make-variable-buffer-local 'erc-server-lines-sent)
@@ -416,6 +420,7 @@ Additionally, detect whether the IRC process has hung."
                               erc-server-last-received-time)
                erc-server-send-ping-interval)
             ;; if the process is hung, kill it
+            (setq erc-server-timed-out t)
             (delete-process erc-server-process)
           (erc-server-send (format "PING %.0f" (erc-current-time)))))
     ;; remove timer if the server buffer has been killed
@@ -456,6 +461,7 @@ We will store server variables in the current buffer."
     (message "%s...done" msg))
   ;; Misc server variables
   (setq erc-server-quitting nil)
+  (setq erc-server-timed-out nil)
   (let ((time (erc-current-time)))
     (setq erc-server-last-sent-time time)
     (setq erc-server-last-ping-time time)
@@ -532,7 +538,8 @@ action."
     (setq erc-server-last-sent-time 0)
     (setq erc-server-lines-sent 0)
     (if (and erc-server-auto-reconnect
-             (not (string-match "^deleted" event))
+             (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)))
         ;; Yuck, this should perhaps funcall




reply via email to

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