Commit c74c4bbc authored by Peter Liljenberg's avatar Peter Liljenberg

Terminate keep-alive in kill-buffer-hook.

Since lyskom-keep-alive-timers is a buffer-local variable,
lyskom-keep-alive-callback can't stop the keep-alive timer
if the buffer has been killed.  As a result, it keeps saying ERROR! in
the mini buffer.

On an idea from Christer Ekholm, terminate the timer explicitly with a
kill-buffer-hook instead.  The error logging in
lyskom-keep-alive-callback has been improved too, to provide more
information on what went wrong if there are other error situations in
the future.
parent ee45a027
2015-12-11 Peter Liljenberg <peter.liljenberg@gmail.com>
* commands2.el: Terminate keep-alive with kill-buffer-hook, as
lyskom-keep-alive-callback can't do it once the buffer is killed.
Also improve error logging in the callback.
2014-10-30 Christer Ekholm <che@chrekh.se>
* Makefile: Use cp -f to copy files to build-directory for target
......
......@@ -2373,13 +2373,14 @@ This command accepts text number prefix arguments \(see
local)
(defun lyskom-keep-alive-callback (buffer)
(condition-case nil
(condition-case callback-error
(save-current-buffer (set-buffer buffer)
(if (eq (process-status lyskom-proc) 'open)
(initiate-get-time 'keep nil)
(lyskom-stop-keep-alive)
(message "Terminating keep-alive")))
(error (message "ERROR!") (lyskom-stop-keep-alive))))
(error (message "Error during keep-alive: %s" callback-error)
(lyskom-stop-keep-alive))))
(def-kom-command kom-keep-alive ()
"Keep the LysKOM session alive by sending a request every once in a
......@@ -2423,7 +2424,12 @@ See `kom-keep-alive' for more information."
(mapc 'disable-timeout lyskom-keep-alive-timers)
(setq lyskom-keep-alive-timers nil))
(defun lyskom-buffer-kill-keep-alive-hook ()
(if lyskom-keep-alive-timers
(message "Terminating keep-alive for buffer %s" (buffer-name (current-buffer))))
(lyskom-stop-keep-alive))
(add-hook 'kill-buffer-hook 'lyskom-buffer-kill-keep-alive-hook)
;;; ========================================================================
;;; Check (if Person is a) member (of Conference)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment