From: Stefan Monnier Date: Thu, 3 Nov 2011 19:28:45 +0000 (-0400) Subject: * lisp/gnus/nnimap.el (nnimap-open-connection-1): Use tcp-keealive if possible. X-Git-Tag: emacs-pretest-24.0.92~227 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3ccc1742ba32bf118c15d19b639032fbf503fcea;p=emacs.git * lisp/gnus/nnimap.el (nnimap-open-connection-1): Use tcp-keealive if possible. --- diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 12cbd30df68..3fb44bb5b10 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,7 @@ +2011-11-03 Stefan Monnier + + * nnimap.el (nnimap-open-connection-1): Use tcp-keealive if possible. + 2011-11-02 Teodor Zlatanov * gnus-util.el (gnus-bound-and-true-p): Another comment to explain why diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 77372c246cb..cda17ba57c6 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -397,6 +397,14 @@ textual parts.") (stream-type (plist-get props :type))) (when (and stream (not (memq (process-status stream) '(open run)))) (setq stream nil)) + + (when (and (fboundp 'set-network-process-option) ;; Not in XEmacs. + (fboundp 'process-type) ;; Emacs 22 doesn't provide it. + (eq (process-type stream) 'network)) + ;; Use TCP-keepalive so that connections that pass through a NAT + ;; router don't hang when left idle. + (set-network-process-option stream :keepalive t)) + (setf (nnimap-process nnimap-object) stream) (setf (nnimap-stream-type nnimap-object) stream-type) (if (not stream)