<<< Date Index >>>     <<< Thread Index >>>

Re: IMAP command pipelining (batched mailbox polling) now in CVS



On Tuesday, 20 December 2005 at 11:06, Vincent Lefevre wrote:
> On 2005-12-19 21:50:40 -0800, Brendan Cully wrote:
> > well, it's progress. At least the IDLE command no longer thinks it's
> > failed. I found another possible bug, and I think This Time It's
> > Really It.
> 
> Hmm... this time Mutt freezes after the fetch; I need to do a Ctrl-\.
> 
> [...]
> imap_open_mailbox: msgcount is 223
> > a0005 IDLE
> < + Waiting for DONE
> > DONE
> a0006 IDLE
> < * 224 EXISTS
> Handling EXISTS
> cmd_handle_untagged: New mail in INBOX - 224 messages total.
> < * 1 RECENT
> < * OK Timeout in 30 minutes
> < a0005 OK IDLE completed
> imap_cmd_finish: Fetching new mail
> message.c:92: mutt_mktemp returns "/var/tmp/mutt-dixsept-325-5673-1".
> > DONE
> a0007 FETCH 224:224 (UID FLAGS INTERNALDATE RFC822.SIZE 
> BODY.PEEK[HEADER.FIELDS (DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES 
> CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST 
> X-LABEL)])

Hmm, it looks like I'm calling imap_cmd_finish too early - I should
wait until the last command in the pipeline has finished. Can you try
the following patch?
diff -r 11578cbc14d9 imap/command.c
--- a/imap/command.c    Wed Dec 21 00:42:41 2005
+++ b/imap/command.c    Tue Dec 20 17:06:01 2005
@@ -185,8 +185,10 @@
     idata->cmds[idata->lastcmd].state = cmd_status (idata->buf);
     idata->lastcmd = (idata->lastcmd + 1) % IMAP_PIPELINE_DEPTH;
     if (idata->lastcmd == idata->nextcmd)
+    {
       rc = cmd_status (idata->buf);
-    imap_cmd_finish (idata);
+      imap_cmd_finish (idata);
+    }
   }
 
   return rc;