From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/64999 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: closing all inactive server connections Date: Tue, 31 Jul 2007 11:57:56 +0900 Organization: Emacsen advocacy group Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1185850845 1033 80.91.229.12 (31 Jul 2007 03:00:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 Jul 2007 03:00:45 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M13508@lists.math.uh.edu Tue Jul 31 05:00: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 1IFhyP-00088X-DF for ding-account@gmane.org; Tue, 31 Jul 2007 05:00: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 1IFhwe-0008BK-Ln; Mon, 30 Jul 2007 21:58:48 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1IFhwc-0008Ar-CU for ding@lists.math.uh.edu; Mon, 30 Jul 2007 21:58:46 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1IFhwW-0006kq-0B for ding@lists.math.uh.edu; Mon, 30 Jul 2007 21:58:46 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1IFhwU-00070n-00 for ; Tue, 31 Jul 2007 04:58:39 +0200 Original-Received: from [66.225.201.151] (port=45768 helo=mail.jpl.org) by orlando.hostforweb.net with esmtpa (Exim 4.63) (envelope-from ) id 1IFhvv-0001bq-AI for ding@gnus.org; Mon, 30 Jul 2007 21:58:04 -0500 X-Hashcash: 1:20:070731:ding@gnus.org::NWp5Xksglzptzb5m:00002EET 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:aRaD9tpIDSTH3z5aTchHvp/RfiU= 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.4 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:64999 Archived-At: --=-=-= >>>>> 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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline --- 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))))) --=-=-= Content-Disposition: inline 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, --=-=-=--