From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/65055 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: closing all inactive server connections Date: Thu, 16 Aug 2007 16:25:47 +0900 Organization: Emacsen advocacy group Message-ID: References: <87zm0tyr2r.fsf@mocca.josefsson.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1187249199 18972 80.91.229.12 (16 Aug 2007 07:26:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Aug 2007 07:26:39 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M13565@lists.math.uh.edu Thu Aug 16 09:26:38 2007 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1ILZkb-0002Ri-Dg for ding-account@gmane.org; Thu, 16 Aug 2007 09:26:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1ILZkU-0004rW-FC; Thu, 16 Aug 2007 02:26:30 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1ILZkS-0004r7-NM for ding@lists.math.uh.edu; Thu, 16 Aug 2007 02:26:28 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1ILZkR-0000W8-BU for ding@lists.math.uh.edu; Thu, 16 Aug 2007 02:26:28 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1ILZkQ-0002SF-00 for ; Thu, 16 Aug 2007 09:26:26 +0200 Original-Received: from [66.225.201.151] (port=44686 helo=mail.jpl.org) by orlando.hostforweb.net with esmtpa (Exim 4.63) (envelope-from ) id 1ILZjs-0003f5-0b for ding@gnus.org; Thu, 16 Aug 2007 02:25:52 -0500 X-Hashcash: 1:20:070816:ding@gnus.org::D9zuAjlu1AFaWFQh:00001T8r X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:xMX6ha+ah/kTYyyXClG0dnqkzCU= X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -2.5 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:65055 Archived-At: --=-=-= >>>>> Katsumi Yamaoka wrote: > So, I wish Simon and Ted to take on this. Sorry, I forgot to attach a patch. Here it is: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Description: Patch for imap.el --- imap.el~ 2007-01-24 07:15:37 +0000 +++ imap.el 2007-08-16 07:10:13 +0000 @@ -273,6 +273,14 @@ :group 'imap :type 'boolean) +(defcustom imap-logout-timeout nil + "Close server immediately if it can't logout in this number of seconds. +If it is nil, never close server until logout completes." + :version "23.0" ;; No Gnus. + :group 'imap + :type '(choice (const :tag "No timeout" nil) + (number :value 1.0))) + ;; Various variables. (defvar imap-fetch-data-hook nil @@ -554,7 +562,7 @@ (not (string-match "failed" response)))) (setq done process) (if (memq (process-status process) '(open run)) - (imap-send-command "LOGOUT")) + (imap-logout)) (delete-process process) nil))))) done)) @@ -629,7 +637,7 @@ (not (string-match "failed" response)))) (setq done process) (if (memq (process-status process) '(open run)) - (imap-send-command "LOGOUT")) + (imap-logout)) (delete-process process) nil))))) done)) @@ -1188,7 +1196,7 @@ (with-current-buffer (or buffer (current-buffer)) (when (imap-opened) (condition-case nil - (imap-send-command-wait "LOGOUT") + (imap-logout-wait) (quit nil))) (when (and imap-process (memq (process-status imap-process) '(open run))) @@ -1243,6 +1251,28 @@ (defun imap-send-command-wait (command &optional buffer) (imap-wait-for-tag (imap-send-command command buffer) buffer)) +(defun imap-logout (&optional buffer) + (if imap-logout-timeout + (eval `(with-timeout (imap-logout-timeout + (condition-case nil + (with-current-buffer ,(or buffer + (current-buffer)) + (delete-process imap-process)) + (error))) + (imap-send-command "LOGOUT" buffer))) + (imap-send-command "LOGOUT" buffer))) + +(defun imap-logout-wait (&optional buffer) + (if imap-logout-timeout + (eval `(with-timeout (imap-logout-timeout + (condition-case nil + (with-current-buffer ,(or buffer + (current-buffer)) + (delete-process imap-process)) + (error))) + (imap-send-command-wait "LOGOUT" buffer))) + (imap-send-command-wait "LOGOUT" buffer))) + ;; Mailbox functions: --=-=-=--