Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: ding@gnus.org
Subject: Re: closing all inactive server connections
Date: Thu, 16 Aug 2007 16:25:47 +0900	[thread overview]
Message-ID: <b4mr6m42b5w.fsf@jpl.org> (raw)
In-Reply-To: <b4meji4ne0z.fsf@jpl.org>

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

>>>>> Katsumi Yamaoka wrote:

> So, I wish Simon and Ted to take on this.

Sorry, I forgot to attach a patch.  Here it is:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch for imap.el --]
[-- Type: text/x-patch, Size: 2212 bytes --]

--- 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)))
+
 \f
 ;; Mailbox functions:
 

  reply	other threads:[~2007-08-16  7:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-07 15:59 Ted Zlatanov
2007-07-10 19:54 ` Ted Zlatanov
2007-07-19 13:46   ` Ted Zlatanov
2007-07-27 17:06     ` Ted Zlatanov
2007-07-28  0:18       ` Ted Zlatanov
2007-07-30  6:22         ` Katsumi Yamaoka
2007-07-30 15:39           ` Ted Zlatanov
2007-07-31  2:57             ` Katsumi Yamaoka
2007-07-31  3:08               ` Katsumi Yamaoka
2007-07-31  3:19                 ` Ted Zlatanov
2007-07-31  8:52                   ` Katsumi Yamaoka
2007-08-02 19:51                     ` Ted Zlatanov
2007-08-15 11:28                     ` Simon Josefsson
2007-08-16  7:18                       ` Katsumi Yamaoka
2007-08-16  7:25                         ` Katsumi Yamaoka [this message]
2007-08-16  9:49                         ` Simon Josefsson
2007-08-16 15:35                           ` Ted Zlatanov
2007-08-16 15:32                       ` Ted Zlatanov
2007-08-16 15:56                         ` Ted Zlatanov
2007-08-16 23:19                           ` Katsumi Yamaoka
2007-08-16 23:25                             ` Ted Zlatanov
2007-08-16 23:47                               ` Katsumi Yamaoka
2007-08-17 11:09                                 ` Katsumi Yamaoka
2007-09-10 14:52                                   ` Ted Zlatanov
2007-08-15 18:28                     ` Reiner Steib
2007-07-31  3:16               ` Ted Zlatanov
2007-07-31  3:19                 ` Katsumi Yamaoka
2007-07-31  2:58             ` untabify Lisp sources (was Re: closing all inactive server connections) Katsumi Yamaoka
2007-07-31 22:05               ` untabify Lisp sources Reiner Steib
2007-08-01  2:44                 ` Ted Zlatanov
2007-07-31 22:57               ` Miles Bader
2007-08-01  2:46                 ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4mr6m42b5w.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).