imapx
imapx copied to clipboard
Bug: IDLE not always working+workaround
Hi,
Recently discovered a bug related to the idling feature. Using VS 2013, C# .NET Desktop app. Following code should work according to documentation:
imapclient.Folders.Inbox.Messages.Download(); imapclient.Folders.Sent.Messages.Download(); imapclient.Folders.Inbox.Select(); imapclient.Folders.Inbox.OnNewMessagesArrived += Inbox_OnNewMessagesArrived; imapclient.Folders.Inbox.StartIdling(); imapclient.Behavior.NoopIssueTimeout = 120;
Unfortunately it doesn't work. After investigation i discovered this in the logs of hMailServer:
"IMAPD" 6676 30497 "2018-11-26 13:48:22.665" "CLIENTIP" "SENT: IMAPX44 OK UID completed" "IMAPD" 6676 30497 "2018-11-26 13:48:22.735" "CLIENTIP" "RECEIVED: IMAPX45 IDLE" "IMAPD" 6676 30497 "2018-11-26 13:48:22.736" "CLIENTIP" "SENT: + idling" "IMAPD" 3536 30497 "2018-11-26 13:48:22.832" "CLIENTIP" "RECEIVED: DONE" "IMAPD" 3536 30497 "2018-11-26 13:48:22.832" "CLIENTIP" "SENT: IMAPX45 OK IDLE terminated"
Turns out ImapX subscribes to idling, but sends a DONE message after, which is interpreted as to stop idling. My guess it's some leftover from downloading messages, because when manually subscribing (long after all messages have been downloaded) it works perfectly fine.