Commit 33ae2a33 authored by Linus Tolke Y's avatar Linus Tolke Y
Browse files

Fixed one racing problem associated with the who-info-buffer.

parent d7055be2
Wed Apr 29 14:47:33 1992 Linus Tolke Y (linus@robert)
* cache.el (lyskom-set-who-info-buffer-2): defensive programming.
Racing conditions, (most dominant when user has user-area and
motd and a lot of presence messages) at login and this function
was called before the buffer was set.
Wed Apr 15 10:32:41 1992 Inge Wallin (inge@robert)
* cache.el(lyskom-set-who-info-buffer-2): Use insert instead of
......
......@@ -108,17 +108,18 @@ this function shall be with current-buffer the BUFFER."
(set-buffer buffer)
(if (zerop lyskom-pers-no)
nil
(if (and (/= (who-info->pers-no info) 0)
(/= (who-info->pers-no info) lyskom-pers-no))
;Don't show myself.
(initiate-get-conf-stat 'follow
'lyskom-show-changed-person
(who-info->pers-no info)
(who-info->working-conf info)
(who-info->doing-what info)))
(if (/= (who-info->working-conf info) 0)
(initiate-get-conf-stat 'void nil
(who-info->working-conf info)))
; This fetches the conf-stats once to much.
; (if (and (/= (who-info->pers-no info) 0)
; (/= (who-info->pers-no info) lyskom-pers-no))
; ;Don't show myself.
; (initiate-get-conf-stat 'follow
; 'lyskom-show-changed-person
; (who-info->pers-no info)
; (who-info->working-conf info)
; (who-info->doing-what info)))
; (if (/= (who-info->working-conf info) 0)
; (initiate-get-conf-stat 'void nil
; (who-info->working-conf info)))
(cache-add-who-info info)))))
((eq msg-no 7) ; Database is syncing.
......
......@@ -259,33 +259,37 @@ ARG: session-info"
"Inserts a who-buffer-info into lyskom-who-info-cache"
;We can use lyskom-insert (not beautiful)
;we insert everything at the end of the buffer.
(let ((sesno lyskom-session-no)
min max
(where (cache-assoc (who-info->connection who-info)
lyskom-who-info-cache)))
(lyskom-save-excursion
(set-buffer lyskom-who-info-buffer)
(save-restriction
(if where
(progn
(narrow-to-region (marker-position
(who-buffer-info->start-marker where))
(1- (marker-position
(who-buffer-info->end-marker where))))
(delete-region (point-min) (point-max)))
(goto-char (point-max))
(insert " ")
(narrow-to-region (point-min) (1- (point-max))))
(setq min (point-max-marker))
(lyskom-print-who-info pers-conf-stat conf-conf-stat who-info sesno
'insert)
(setq max (point-max-marker))
(goto-char (point-max)))
(delete-char 1))
(cache-add (who-info->connection who-info)
(lyskom-create-who-buffer-info who-info min max)
'lyskom-who-info-cache)
(run-hooks 'lyskom-who-info-has-changed-hook)))
;defensive programming and it will work:
(if (and lyskom-who-info-buffer-is-on
lyskom-who-info-buffer)
(let ((sesno lyskom-session-no)
min max
(where (cache-assoc (who-info->connection who-info)
lyskom-who-info-cache)))
(lyskom-save-excursion
(set-buffer lyskom-who-info-buffer)
(save-restriction
(if where
(progn
(narrow-to-region (marker-position
(who-buffer-info->start-marker where))
(1- (marker-position
(who-buffer-info->end-marker where))))
(delete-region (point-min) (point-max)))
(goto-char (point-max))
(insert " ")
(narrow-to-region (point-min) (1- (point-max))))
(setq min (point-max-marker))
(lyskom-print-who-info pers-conf-stat conf-conf-stat who-info sesno
'insert)
(setq max (point-max-marker))
(goto-char (point-max)))
(delete-char 1))
(cache-add (who-info->connection who-info)
(lyskom-create-who-buffer-info who-info min max)
'lyskom-who-info-cache)
(run-hooks 'lyskom-who-info-has-changed-hook))))
(defun lyskom-set-session-info (pers-conf-stat conf-conf-stat session-info)
......
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