Changeset 5495:36aa1130091a for imap

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.

Location:
imap
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • 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}