Changeset 5495:36aa1130091a

Show
Ignore:
Timestamp:
2008-08-25 00:52:17 (3 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

Introduce $imap_pipeline_depth.
This lets users control the number of commands that mutt will queue up
before sending them to the server. Setting this to 0 disables
pipelining, which should close #2892.

Files:
9 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5493 r5495  
    1 2008-08-24 17:06 +0200  Rocco Rutte  <pdmef@gmx.net>  (fec35f9ad30f) 
     12008-08-25 00:16 -0700  Brendan Cully  <brendan@kublai.com>  (53d9210aa4ee) 
     2 
     3        * imap/command.c, imap/imap.c, imap/imap_private.h, imap/message.c: 
     4        Rework IMAP command queueing to allow pipelining to be disabled. 
     5        IDLE handling has been better abstracted, and there are fewer entry 
     6        points to the IMAP command issuing machinery. Any commands that are 
     7        simply queued may be executed whenever the pipeline fills, instead 
     8        of requiring explicit handling in the caller. 
     9 
     10        Tested on my Cyrus server, but I wouldn't be surprise if this causes 
     11        new problems. 
     12 
     132008-08-24 20:01 +0200  Rocco Rutte  <pdmef@gmx.net>  (045c5942e1ad) 
     14 
     15        * doc/manual.xml.head: Manual: Fix DTD validation error and 
     16        message header display section 
    217 
    318        * doc/manual.xml.head: Manual: Fix typo 
    419 
    5 2008-08-24 17:03 +0200  Rocco Rutte  <pdmef@gmx.net>  (a2fc5e7c77ae) 
    6  
    7         * ChangeLog, doc/manual.xml.head: Manual: Fix style and typos. Noted 
    8         by Vincent Lefevre, see #3109. 
     20        * doc/manual.xml.head: Manual: Fix style and typos. Noted by 
     21        Vincent Lefevre, see #3109. 
    922 
    10232008-08-23 15:25 -0700  Brendan Cully  <brendan@kublai.com>  (1f9849496bc2) 
     
    1225        * main.c: Whitespace cleanup 
    1326 
    14 2008-08-23 15:21 -0700  Brendan Cully  <brendan@kublai.com>  (63efed810906) 
    15  
    16         * ChangeLog, main.c: Fix infinite loop with "mutt -", introduced in 
     27        * main.c: Fix infinite loop with "mutt -", introduced in 
    1728        [31c9e9727d42]. Treats - as a non-option argument. It would be 
    1829        reasonable to treat it as an error instead. 
  • UPDATING

    r5431 r5495  
    77hg tip: 
    88 
     9  + $imap_pipeline_depth controls the number of commands that mutt can issue 
     10    to an IMAP server before it must collect the responses 
    911  + $ssl_client_cert available with gnutls as well as openssl 
    1012  + 'mime_lookup application/octet-stream' added to system Muttrc 
  • globals.h

    r5431 r5495  
    210210#ifdef USE_IMAP 
    211211WHERE short ImapKeepalive; 
     212WHERE short ImapPipelineDepth; 
    212213#endif 
    213214 
  • imap/command.c

    r5494 r5495  
    158158        { 
    159159          /* first command in queue has finished - move queue pointer up */ 
    160           idata->lastcmd = (idata->lastcmd + 1) % IMAP_PIPELINE_DEPTH; 
     160          idata->lastcmd = (idata->lastcmd + 1) % idata->cmdslots; 
    161161        } 
    162162        cmd->state = cmd_status (idata->buf); 
     
    169169    } 
    170170 
    171     c = (c + 1) % IMAP_PIPELINE_DEPTH; 
     171    c = (c + 1) % idata->cmdslots; 
    172172  } 
    173173  while (c != idata->nextcmd); 
     
    309309static int cmd_queue_full (IMAP_DATA* idata) 
    310310{ 
    311   if ((idata->nextcmd + 1) % IMAP_PIPELINE_DEPTH == idata->lastcmd) 
     311  if ((idata->nextcmd + 1) % idata->cmdslots == idata->lastcmd) 
    312312    return 1; 
    313313 
     
    328328 
    329329  cmd = idata->cmds + idata->nextcmd; 
    330   idata->nextcmd = (idata->nextcmd + 1) % IMAP_PIPELINE_DEPTH; 
     330  idata->nextcmd = (idata->nextcmd + 1) % idata->cmdslots; 
    331331 
    332332  snprintf (cmd->seq, sizeof (cmd->seq), "a%04u", idata->seqno++); 
  • imap/imap.c

    r5494 r5495  
    487487  idata->state = IMAP_DISCONNECTED; 
    488488  idata->seqno = idata->nextcmd = idata->lastcmd = idata->status = 0; 
    489   memset (idata->cmds, 0, sizeof (IMAP_COMMAND) * IMAP_PIPELINE_DEPTH); 
     489  memset (idata->cmds, 0, sizeof (IMAP_COMMAND) * idata->cmdslots); 
    490490} 
    491491 
  • imap/imap_private.h

    r5494 r5495  
    5454/* number of entries in the hash table */ 
    5555#define IMAP_CACHE_LEN 10 
    56  
    57 /* number of commands that can be batched into a single request 
    58  * ( - 1, for the easy way to detect ring buffer wrap) */ 
    59 #define IMAP_PIPELINE_DEPTH 15 
    6056 
    6157#define SEQLEN 5 
     
    191187 
    192188  /* command queue */ 
    193   IMAP_COMMAND cmds[IMAP_PIPELINE_DEPTH]; 
     189  IMAP_COMMAND* cmds; 
     190  int cmdslots; 
    194191  int nextcmd; 
    195192  int lastcmd; 
  • imap/util.c

    r5122 r5495  
    355355    FREE (&idata); 
    356356 
     357  idata->cmdslots = ImapPipelineDepth + 2; 
     358  if (!(idata->cmds = safe_calloc(idata->cmdslots, sizeof(*idata->cmds)))) 
     359  { 
     360    mutt_buffer_free(&idata->cmdbuf); 
     361    FREE (&idata); 
     362  } 
     363 
    357364  return idata; 
    358365} 
     
    370377  FREE (&(*idata)->buf); 
    371378  mutt_bcache_close (&(*idata)->bcache); 
     379  FREE (&(*idata)->cmds); 
    372380  FREE (idata);         /* __FREE_CHECKED__ */ 
    373381} 
  • init.c

    r5482 r5495  
    21172117          *ptr = -*ptr; 
    21182118      } 
     2119#ifdef USE_IMAP 
     2120      else if (mutt_strcmp (MuttVars[idx].option, "imap_pipeline_depth") == 0) 
     2121      { 
     2122        if (*ptr < 0) 
     2123          *ptr = 0; 
     2124      } 
     2125#endif 
    21192126    } 
    21202127    else if (DTYPE (MuttVars[idx].type) == DT_QUAD) 
  • init.h

    r5486 r5495  
    969969  ** but can make closing an IMAP folder somewhat slower. This option 
    970970  ** exists to appease speed freaks. 
     971  */ 
     972  { "imap_pipeline_depth", DT_NUM,  R_NONE, UL &ImapPipelineDepth, 15 }, 
     973  /* 
     974  ** .pp 
     975  ** Controls the number of IMAP commands that may be queued up before they 
     976  ** are sent to the server. A deeper pipeline reduces the amount of time 
     977  ** mutt must wait for the server, and can make IMAP servers feel much 
     978  ** more responsive. But not all servers correctly handle pipelined commands, 
     979  ** so if you have problems you might want to try setting this variable to 0. 
     980  ** .pp 
     981  ** \fBNote:\fP Changes to this variable have no effect on open connections. 
    971982  */ 
    972983  { "imap_servernoise",         DT_BOOL, R_NONE, OPTIMAPSERVERNOISE, 1 },