From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/433 Path: news.gmane.org!not-for-mail From: Ketanu Newsgroups: gmane.emacs.gnus.user Subject: Working arounf for deaf server [DEAF][NNTP][PATCH] Date: 11 May 2002 13:33:17 +0200 Organization: (none) Message-ID: <873cwyvs02.fsf@ketanu.dyndns.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1138667408 6885 80.91.229.2 (31 Jan 2006 00:30:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 Jan 2006 00:30:08 +0000 (UTC) Original-X-From: nobody Tue Jan 17 17:27:35 2006 Original-Path: quimby.gnus.org!lackawana.kippona.com!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!proxad.net!wanadoo.fr!not-for-mail Original-Newsgroups: gnu.emacs.gnus Original-NNTP-Posting-Host: amontpellier-203-1-4-248.abo.wanadoo.fr Original-X-Trace: wanadoo.fr 1021116891 21349 80.14.105.248 (11 May 2002 11:34:51 GMT) Original-X-Complaints-To: abuse@wanadoo.fr Original-NNTP-Posting-Date: 11 May 2002 11:34:51 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Xref: bridgekeeper.physik.uni-ulm.de gnus-emacs-gnus:573 Original-Lines: 115 X-Gnus-Article-Number: 573 Tue Jan 17 17:27:35 2006 Xref: news.gmane.org gmane.emacs.gnus.user:433 Archived-At: Yo, i experimented a probleme with deaf server, it means, servers that dont'pay you any attention when you don't talk to them for a few minutes. They keep the network connection alive but do not respond anymore. I modified nntp.el in a convenient way and the nntp-connection is automagically closed when needed, the server is expected to be consistent in the following way : A deaf server is a server which can be attached a duration d with the property : when no exchange took place on the connection for more than d, the connection is obsoleted (it is not closed but the server do not pay attention to you any more, hewill hence not respond you, making gnus and emacs hang up for a few minutes). Here is a patch, check functions `nntp-deaf-cancel-timer' `nntp-deaf-reset-timer' `nntp-deaf-run-hook' and variables `nntp-deaf-timeout' `nntp-deaf-hook' `nntp-deaf-timer' for getting some more information i do not really now why it worked when i modified `nntp-wait-for' if someone knows if it is really bad or if it is convenient, please tell me. i did not encounter any error with it, and now connections works great. ---- cut here ---- *** nntp.el Sat May 11 12:40:28 2002 --- nntp-patched.el Sat May 11 12:58:33 2002 *************** *** 159,164 **** --- 159,208 ---- (defvoo nntp-coding-system-for-write 'binary "*Coding system to write to NNTP.") + (defvar nntp-deaf-timeout 100 + "*Deaf timeout is for servers becoming deaf + + Some server, such as ft server news.wanadoo.fr seems to get deaf when not + being talked after a certain amount of time, thus it is proposed to run a + hook a fixed amount after the last characters have been read from the + server, this hook is `nntp-deaf-hook' + + non-'nil value should be interpreted with the same + semantic as with the `run-at-time' fucntion + 'nil indicates the server never comes deaf, so the the hook is never run") + + (defvar nntp-deaf-timer 'nil + "*Holding timer from `run-at-time' for cancelling it") + (defvar nntp-deaf-hook '(nntp-close-server) + "*Hook to be run when `nntp-deaf-timeout' is elapsed + + This hook is to be run whenever no characters were taken from the + nntp-connection for more than `nntp-deaf-timer' + + A plausible use of it is to hold the function `nntp-close-server', + so the default value is '(nntp-close-server)") + (defun nntp-deaf-run-hook () + "Runs the hook 'nntp-deaf-hook'" + (run-hooks 'nntp-deaf-hook)) + + (defun nntp-deaf-cancel-timer () + "*Cancel the timer `nntp-deaf-timer' + + This is to be called when, for example, reading characters, to avoid the timeout + blindly shut down the connection when in use" + (if (timerp 'nntp-deaf-timer) + (cancel-timer 'nntp-deaf-timer))) + + (defun nntp-deaf-reset-timer () + "*Reset the timer `nntp-deaf-timer' + + This is to be called whenever a character input end, it reset up the timer that + may close the nntp-connection when needed." + (nntp-deaf-cancel-timer) + (setq nntp-deaf-timer + (run-at-time nntp-deaf-timeout 'nil 'nntp-deaf-run-hook))) + + (defcustom nntp-authinfo-file "~/.authinfo" ".netrc-like file that holds nntp authinfo passwords." :type *************** *** 257,262 **** --- 301,307 ---- (save-excursion (set-buffer (process-buffer process)) (goto-char (point-min)) + (nntp-deaf-cancel-timer) (while (and (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5))) (looking-at "480")) (memq (process-status process) '(open run))) *************** *** 292,297 **** --- 337,344 ---- (setq nntp-have-messaged nil) (nnheader-message 5 "")) t)))) + ;; + (nntp-deaf-reset-timer) (unless discard (erase-buffer))))) ---- cut here ---- -- Ketanu