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: Tue, 31 Jul 2007 11:57:56 +0900	[thread overview]
Message-ID: <b4mk5shb7pn.fsf@jpl.org> (raw)
In-Reply-To: <m2ps29oq7k.fsf@lifelogs.com>

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

>>>>> Ted Zlatanov wrote:

>>> (defun gnus-server-close-all-servers ()
>>> "Close all servers."

[...]

KY> I can agree to this change if it is really helpful to you.  But
KY> you still need to type `C-g' for almost servers when the VPN is
KY> disconnected, don't you?  Even so, is it really helpful to you?
KY> I don't have a problem like yours and don't know how to reproduce
KY> it without VPN, so don't know how to solve it so far.

> Yes, I need C-g, but I don't need to

> 1) go to each opened server
> 2) press C
> 3) press C-g

> (repeat 3-4 times for each foreign server that's hung)

> now I just

> 1) M-c
> 2) press C-g for whatever hangs.

> Much better user experience.  Of course, avoiding the C-g would be even
> better; my other question in the original e-mail was if I can tell Emacs
> all these connections are truly dead so Gnus doesn't hang trying to
> close them.

I see.  Though I've never looked into this problem throughly,
the cause is often `accept-process-output' to which the timeout is
not specified.  So, I guess `nntp-wait-for-string' is the culprit
(I have no idea for IMAP connections).  To verify it, we probably
need to remove all the `condition-case' forms and `ignore-errors'
forms from nntp.el.  But, er, it might be hard to do.  How about
deleting the processes immediately instead of quitting mannerly?
The following patch forces Gnus to delete the nntp process if
the server doesn't respond when Gnus tries to open it for sending
the QUIT command:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1034 bytes --]

--- nntp.el~	2007-07-18 12:07:39 +0000
+++ nntp.el	2007-07-31 02:54:25 +0000
@@ -978,8 +978,12 @@
       (or (nntp-find-connection nntp-server-buffer)
 	  (nntp-open-connection nntp-server-buffer)))))
 
+(defvar nntp-force-close-server nil
+  "Non-nil means force server to close if it doesn't respond immediately.")
+
 (deffoo nntp-close-server (&optional server)
-  (nntp-possibly-change-group nil server t)
+  (let ((nntp-force-close-server t))
+    (nntp-possibly-change-group nil server t))
   (let ((process (nntp-find-connection nntp-server-buffer)))
     (while process
       (when (memq (process-status process) '(open run))
@@ -1728,7 +1732,10 @@
     (while (and (setq proc (get-buffer-process buf))
 		(memq (process-status proc) '(open run))
 		(not (re-search-forward regexp nil t)))
-      (accept-process-output proc)
+      (if nntp-force-close-server
+	  (unless (accept-process-output proc 1)
+	    (delete-process proc))
+	(accept-process-output proc))
       (set-buffer buf)
       (goto-char (point-min)))))
 

[-- Attachment #3: Type: text/plain, Size: 245 bytes --]

KY> In addition, isn't it unnecessary to use `let'?  I mean:

[...]

> I was debugging, so the variable was handy.  I am OK with your version.

I see.  If you think the variable will be useful in the future
too, please leave it as is.

Regards,

  reply	other threads:[~2007-07-31  2:57 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 [this message]
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
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=b4mk5shb7pn.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).