+2005-01-08 Yuuichi Teranishi <teranisi@gohome.org>
+
+ * elmo-net.el (elmo-network-session-idle-timeout): New option.
+ (elmo-network-session): New attribute `last-accessed'.
+ (elmo-network-get-session): Discard network cache if elapsed time
+ since last-accessed is larger than elmo-network-session-idle-timeout.
+
2005-01-07 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* elmo.el (elmo-find-fetch-strategy): Removed argument `entity'
(defvar sasl-mechanisms)
+(defcustom elmo-network-session-idle-timeout nil
+ "Idle timeout of the network cache. Specified in seconds.
+If elapsed time since last access is larger than this value,
+cached session is not reused.
+If nil, network cache is reused."
+ :type 'number
+ :group 'elmo)
+
;;; Code:
;;
(eval-and-compile
auth
stream-type
process
- greeting))
+ greeting
+ last-accessed))
(luna-define-internal-accessors 'elmo-network-session))
(luna-define-generic elmo-network-initialize-session (session)
(setq pair (assoc (setq key (elmo-network-session-cache-key name folder))
elmo-network-session-cache))
(when (and pair
- (not (memq (process-status
- (elmo-network-session-process-internal
- (cdr pair)))
- '(open run))))
+ (or (not (memq (process-status
+ (elmo-network-session-process-internal
+ (cdr pair)))
+ '(open run)))
+ (and elmo-network-session-idle-timeout
+ (elmo-network-session-last-accessed-internal
+ (cdr pair))
+ (elmo-time-expire
+ (elmo-network-session-last-accessed-internal
+ (cdr pair))
+ elmo-network-session-idle-timeout))))
(setq elmo-network-session-cache
(delq pair elmo-network-session-cache))
(elmo-network-close-session (cdr pair))
(setq pair nil))
(if pair
- (cdr pair) ; connection cache exists.
+ (progn
+ (elmo-network-session-set-last-accessed-internal
+ (cdr pair) (current-time))
+ (cdr pair)) ; connection cache exists.
(unless if-exists
(setq session
(elmo-network-open-session
:auth auth
:stream-type stream-type
:process nil
- :greeting nil))
+ :greeting nil
+ :last-accessed (current-time)
+ ))
(buffer (format " *%s session for %s@%s:%d%s"
name
user