Changeset 5495:36aa1130091a
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r5493
|
r5495
|
|
| 1 | | 2008-08-24 17:06 +0200 Rocco Rutte <pdmef@gmx.net> (fec35f9ad30f) |
| | 1 | 2008-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 | |
| | 13 | 2008-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 |
| 2 | 17 | |
| 3 | 18 | * doc/manual.xml.head: Manual: Fix typo |
| 4 | 19 | |
| 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. |
| 9 | 22 | |
| 10 | 23 | 2008-08-23 15:25 -0700 Brendan Cully <brendan@kublai.com> (1f9849496bc2) |
| … |
… |
|
| 12 | 25 | * main.c: Whitespace cleanup |
| 13 | 26 | |
| 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 |
| 17 | 28 | [31c9e9727d42]. Treats - as a non-option argument. It would be |
| 18 | 29 | reasonable to treat it as an error instead. |
-
|
r5431
|
r5495
|
|
| 7 | 7 | hg tip: |
| 8 | 8 | |
| | 9 | + $imap_pipeline_depth controls the number of commands that mutt can issue |
| | 10 | to an IMAP server before it must collect the responses |
| 9 | 11 | + $ssl_client_cert available with gnutls as well as openssl |
| 10 | 12 | + 'mime_lookup application/octet-stream' added to system Muttrc |
-
|
r5431
|
r5495
|
|
| 210 | 210 | #ifdef USE_IMAP |
| 211 | 211 | WHERE short ImapKeepalive; |
| | 212 | WHERE short ImapPipelineDepth; |
| 212 | 213 | #endif |
| 213 | 214 | |
-
|
r5494
|
r5495
|
|
| 158 | 158 | { |
| 159 | 159 | /* 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; |
| 161 | 161 | } |
| 162 | 162 | cmd->state = cmd_status (idata->buf); |
| … |
… |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | | c = (c + 1) % IMAP_PIPELINE_DEPTH; |
| | 171 | c = (c + 1) % idata->cmdslots; |
| 172 | 172 | } |
| 173 | 173 | while (c != idata->nextcmd); |
| … |
… |
|
| 309 | 309 | static int cmd_queue_full (IMAP_DATA* idata) |
| 310 | 310 | { |
| 311 | | if ((idata->nextcmd + 1) % IMAP_PIPELINE_DEPTH == idata->lastcmd) |
| | 311 | if ((idata->nextcmd + 1) % idata->cmdslots == idata->lastcmd) |
| 312 | 312 | return 1; |
| 313 | 313 | |
| … |
… |
|
| 328 | 328 | |
| 329 | 329 | cmd = idata->cmds + idata->nextcmd; |
| 330 | | idata->nextcmd = (idata->nextcmd + 1) % IMAP_PIPELINE_DEPTH; |
| | 330 | idata->nextcmd = (idata->nextcmd + 1) % idata->cmdslots; |
| 331 | 331 | |
| 332 | 332 | snprintf (cmd->seq, sizeof (cmd->seq), "a%04u", idata->seqno++); |
-
|
r5494
|
r5495
|
|
| 487 | 487 | idata->state = IMAP_DISCONNECTED; |
| 488 | 488 | 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); |
| 490 | 490 | } |
| 491 | 491 | |
-
|
r5494
|
r5495
|
|
| 54 | 54 | /* number of entries in the hash table */ |
| 55 | 55 | #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 |
| 60 | 56 | |
| 61 | 57 | #define SEQLEN 5 |
| … |
… |
|
| 191 | 187 | |
| 192 | 188 | /* command queue */ |
| 193 | | IMAP_COMMAND cmds[IMAP_PIPELINE_DEPTH]; |
| | 189 | IMAP_COMMAND* cmds; |
| | 190 | int cmdslots; |
| 194 | 191 | int nextcmd; |
| 195 | 192 | int lastcmd; |
-
|
r5122
|
r5495
|
|
| 355 | 355 | FREE (&idata); |
| 356 | 356 | |
| | 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 | |
| 357 | 364 | return idata; |
| 358 | 365 | } |
| … |
… |
|
| 370 | 377 | FREE (&(*idata)->buf); |
| 371 | 378 | mutt_bcache_close (&(*idata)->bcache); |
| | 379 | FREE (&(*idata)->cmds); |
| 372 | 380 | FREE (idata); /* __FREE_CHECKED__ */ |
| 373 | 381 | } |
-
|
r5482
|
r5495
|
|
| 2117 | 2117 | *ptr = -*ptr; |
| 2118 | 2118 | } |
| | 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 |
| 2119 | 2126 | } |
| 2120 | 2127 | else if (DTYPE (MuttVars[idx].type) == DT_QUAD) |
-
|
r5486
|
r5495
|
|
| 969 | 969 | ** but can make closing an IMAP folder somewhat slower. This option |
| 970 | 970 | ** 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. |
| 971 | 982 | */ |
| 972 | 983 | { "imap_servernoise", DT_BOOL, R_NONE, OPTIMAPSERVERNOISE, 1 }, |