Get rid of the problematic keepalive timer

Without fail it kills all my connections.
This commit is contained in:
Neale Pickett 2010-10-01 14:51:50 -06:00
parent 2146f06ca6
commit 092ca9d36f
1 changed files with 1 additions and 29 deletions

View File

@ -346,9 +346,6 @@ It should take the same arguments as `open-network-stream' does."
"List of urls seen in the current buffer.") "List of urls seen in the current buffer.")
(put 'rcirc-urls 'permanent-local t) (put 'rcirc-urls 'permanent-local t)
(defvar rcirc-timeout-seconds 600
"Kill connection after this many seconds if there is no activity.")
(defconst rcirc-id-string (concat "rcirc on GNU Emacs " emacs-version)) (defconst rcirc-id-string (concat "rcirc on GNU Emacs " emacs-version))
(defvar rcirc-startup-channels nil) (defvar rcirc-startup-channels nil)
@ -448,11 +445,9 @@ If ARG is non-nil, instead prompt for connection parameters."
(defvar rcirc-process-output nil) (defvar rcirc-process-output nil)
(defvar rcirc-topic nil) (defvar rcirc-topic nil)
(defvar rcirc-keepalive-timer nil)
(defvar rcirc-last-server-message-time nil) (defvar rcirc-last-server-message-time nil)
(defvar rcirc-server nil) ; server provided by server (defvar rcirc-server nil) ; server provided by server
(defvar rcirc-server-name nil) ; server name given by 001 response (defvar rcirc-server-name nil) ; server name given by 001 response
(defvar rcirc-timeout-timer nil)
(defvar rcirc-user-disconnect nil) (defvar rcirc-user-disconnect nil)
(defvar rcirc-connecting nil) (defvar rcirc-connecting nil)
(defvar rcirc-process nil) (defvar rcirc-process nil)
@ -500,8 +495,6 @@ If ARG is non-nil, instead prompt for connection parameters."
(setq rcirc-startup-channels startup-channels) (setq rcirc-startup-channels startup-channels)
(make-local-variable 'rcirc-last-server-message-time) (make-local-variable 'rcirc-last-server-message-time)
(setq rcirc-last-server-message-time (current-time)) (setq rcirc-last-server-message-time (current-time))
(make-local-variable 'rcirc-timeout-timer)
(setq rcirc-timeout-timer nil)
(make-local-variable 'rcirc-user-disconnect) (make-local-variable 'rcirc-user-disconnect)
(setq rcirc-user-disconnect nil) (setq rcirc-user-disconnect nil)
(make-local-variable 'rcirc-connecting) (make-local-variable 'rcirc-connecting)
@ -516,10 +509,6 @@ If ARG is non-nil, instead prompt for connection parameters."
(rcirc-send-string process (concat "USER " user-name (rcirc-send-string process (concat "USER " user-name
" 0 * :" full-name)) " 0 * :" full-name))
;; setup ping timer if necessary
(unless rcirc-keepalive-timer
(setq rcirc-keepalive-timer
(run-at-time 0 (/ rcirc-timeout-seconds 2) 'rcirc-keepalive)))
(message "Connecting to %s...done" server) (message "Connecting to %s...done" server)
@ -551,10 +540,7 @@ last ping."
(time-to-seconds (time-to-seconds
(current-time)) (current-time))
(float-time))))))) (float-time)))))))
(rcirc-process-list)) (rcirc-process-list))))
;; no processes, clean up timer
(cancel-timer rcirc-keepalive-timer)
(setq rcirc-keepalive-timer nil)))
(defun rcirc-handler-ctcp-KEEPALIVE (process target sender message) (defun rcirc-handler-ctcp-KEEPALIVE (process target sender message)
(with-rcirc-process-buffer process (with-rcirc-process-buffer process
@ -623,7 +609,6 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
(defun rcirc-filter (process output) (defun rcirc-filter (process output)
"Called when PROCESS receives OUTPUT." "Called when PROCESS receives OUTPUT."
(rcirc-debug process output) (rcirc-debug process output)
(rcirc-reschedule-timeout process)
(with-rcirc-process-buffer process (with-rcirc-process-buffer process
(setq rcirc-last-server-message-time (current-time)) (setq rcirc-last-server-message-time (current-time))
(setq rcirc-process-output (concat rcirc-process-output output)) (setq rcirc-process-output (concat rcirc-process-output output))
@ -634,18 +619,6 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
(split-string rcirc-process-output "[\n\r]" t)) (split-string rcirc-process-output "[\n\r]" t))
(setq rcirc-process-output nil)))) (setq rcirc-process-output nil))))
(defun rcirc-reschedule-timeout (process)
(with-rcirc-process-buffer process
(when (not rcirc-connecting)
(with-rcirc-process-buffer process
(when rcirc-timeout-timer (cancel-timer rcirc-timeout-timer))
(setq rcirc-timeout-timer (run-at-time rcirc-timeout-seconds nil
'rcirc-delete-process
process))))))
(defun rcirc-delete-process (process)
(delete-process process))
(defvar rcirc-trap-errors-flag t) (defvar rcirc-trap-errors-flag t)
(defun rcirc-process-server-response (process text) (defun rcirc-process-server-response (process text)
(if rcirc-trap-errors-flag (if rcirc-trap-errors-flag
@ -2376,7 +2349,6 @@ keywords when no KEYWORD is given."
(rcirc-handler-generic process "001" sender args text) (rcirc-handler-generic process "001" sender args text)
(with-rcirc-process-buffer process (with-rcirc-process-buffer process
(setq rcirc-connecting nil) (setq rcirc-connecting nil)
(rcirc-reschedule-timeout process)
(setq rcirc-server-name sender) (setq rcirc-server-name sender)
(setq rcirc-nick (car args)) (setq rcirc-nick (car args))
(rcirc-update-prompt) (rcirc-update-prompt)