]> granicus.if.org Git - neomutt/commitdiff
Make IMAP keepalive configurable. From Brendan Cully.
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 22 Oct 2001 09:28:24 +0000 (09:28 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 22 Oct 2001 09:28:24 +0000 (09:28 +0000)
globals.h
imap/util.c
init.h

index 65ffb2da2d14e8131a5cd44ea5925e3e967a46c9..a9f080810a21d1fab592f6f636754933f3b98a8b 100644 (file)
--- a/globals.h
+++ b/globals.h
@@ -149,6 +149,9 @@ WHERE short WriteInc;
 WHERE short ScoreThresholdDelete;
 WHERE short ScoreThresholdRead;
 WHERE short ScoreThresholdFlag;
+#ifdef USE_IMAP
+WHERE short ImapKeepalive;
+#endif
 
 /* flags for received signals */
 WHERE SIG_ATOMIC_VOLATILE_T SigAlrm INITVAL (0);
index 7f88dbac919d45a3fcbb11a8baf8b2ff68764105..fce8b52816e5efe17f4398000209f6ebec9f697c 100644 (file)
@@ -594,14 +594,12 @@ int imap_wait_keepalive (pid_t pid)
 
   sigaction (SIGALRM, &act, &oldalrm);
 
-  /* RFC 2060 specifies a minimum of 30 minutes before disconnect when in
-   * the AUTHENTICATED state. We'll poll at half that. */
-  alarm (900);
+  alarm (ImapKeepalive);
   while (waitpid (pid, &rc, 0) < 0 && errno == EINTR)
   {
     alarm (0); /* cancel a possibly pending alarm */
     imap_keepalive ();
-    alarm (900);
+    alarm (ImapKeepalive);
   }
 
   alarm (0);   /* cancel a possibly pending alarm */
diff --git a/init.h b/init.h
index 678b44e5db479f7232110a18e7d79ba8f5bc45e3..23395e033f7420026378b6623f764f101acf9d0f 100644 (file)
--- a/init.h
+++ b/init.h
@@ -712,6 +712,17 @@ struct option_t MuttVars[] = {
   ** your INBOX in the IMAP browser. If you see something else, you may set
   ** this variable to the IMAP path to your folders.
   */
+  { "imap_keepalive",           DT_NUM,  R_NONE, UL &ImapKeepalive, 900 },
+  /*
+  ** .pp
+  ** This variable specifies the maximum amount of time in seconds that mutt
+  ** will wait before polling open IMAP connections, to prevent the server
+  ** from closing them before mutt has finished with them. The default is
+  ** well within the RFC-specified minimum amount of time (30 minutes) before
+  ** a server is allowed to do this, but in practice the RFC does get
+  ** violated every now and then. Reduce this number if you find yourself
+  ** getting disconnected from your IMAP server due to inactivity.
+  */
   { "imap_list_subscribed",    DT_BOOL, R_NONE, OPTIMAPLSUB, 0 },
   /*
   ** .pp