nnimap.el (nnimap-open-connection-1): Use tcp-keealive if possible.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 3 Nov 2011 22:11:57 +0000 (22:11 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 3 Nov 2011 22:11:57 +0000 (22:11 +0000)
lisp/ChangeLog
lisp/nnimap.el

index e8d44de..0d7d392 100644 (file)
@@ -6,6 +6,10 @@
 
        * message.el (message-send-and-exit): Document `arg'.
 
+2011-11-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * nnimap.el (nnimap-open-connection-1): Use tcp-keealive if possible.
+
 2011-11-02  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * gnus-sync.el: More commentary about `gnus-sync-read' issues.
index 77372c2..cda17ba 100644 (file)
@@ -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)