Function: nntp-with-open-group-function
nntp-with-open-group-function is a byte-compiled function defined in
nntp.el.gz.
Signature
(nntp-with-open-group-function GROUP SERVER CONNECTIONLESS BODYFUN)
Documentation
Protect against servers that don't like clients that keep idle connections open.
The problem being that these servers may either close a connection or
simply ignore any further requests on a connection. Closed
connections are not detected until accept-process-output has updated
the process-status. Dropped connections are not detected until the
connection timeouts (which may be several minutes) or
nntp-connection-timeout has expired. When these occur
nntp-with-open-group, opens a new connection then re-issues the NNTP
command whose response triggered the error.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/nntp.el.gz
(defun nntp-with-open-group-function (group server connectionless bodyfun)
"Protect against servers that don't like clients that keep idle connections open.
The problem being that these servers may either close a connection or
simply ignore any further requests on a connection. Closed
connections are not detected until `accept-process-output' has updated
the `process-status'. Dropped connections are not detected until the
connection timeouts (which may be several minutes) or
`nntp-connection-timeout' has expired. When these occur
`nntp-with-open-group', opens a new connection then re-issues the NNTP
command whose response triggered the error."
(let ((nntp-report-n nntp--report-1)
(nntp--report-1 t)
(nntp-with-open-group-internal nil))
(while (catch 'nntp-with-open-group-error
;; Open the connection to the server
;; NOTE: Existing connections are NOT tested.
(nntp-possibly-change-group group server connectionless)
(let ((timer
(and nntp-connection-timeout
(run-at-time
nntp-connection-timeout nil
(lambda ()
(let* ((process (nntp-find-connection
nntp-server-buffer))
(buffer (and process
(process-buffer process))))
;; When I an able to identify the
;; connection to the server AND I've
;; received NO response for
;; nntp-connection-timeout seconds.
(when (and buffer (eq 0 (buffer-size buffer)))
;; Close the connection. Take no
;; other action as the accept input
;; code will handle the closed
;; connection.
(nntp-kill-buffer buffer))))))))
(unwind-protect
(setq nntp-with-open-group-internal
(condition-case nil
(funcall bodyfun)
(quit
(unless debug-on-quit
(nntp-close-server))
(signal 'quit nil))))
(when timer
(cancel-timer timer)))
nil))
(setq nntp--report-1 nntp-report-n))
nntp-with-open-group-internal))