IMAP的idle-search-idle是否存在竞争条件? [英] Is there a race condition in IMAP's idle-search-idle?

查看:69
本文介绍了IMAP的idle-search-idle是否存在竞争条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆执行IMAP命令的代码搜索,空闲,完成,搜索,空闲,完成,搜索...".

I have a bunch of code that does IMAP commands "search, idle, done, search, idle, done, search, ...".

某些消息是否有可能在搜索命令和空闲命令之间到达,从而仅在空闲返回/超时之后被该代码接收?

Is it possible that some messages arrive between search and idle commands and, thus, will only be received by that code after the idle return / timeout?

我使用GMail进行了尝试:在消息处理和IDLE之间进行了睡眠60测试,即使有消息,IDLE也不会在超时之前返回;为了确保我不会错过IDLE的事件,我进行了一个客户端发送/接收转储,并在sleep()之后发送IDLE之前尝试了一个额外的read();在sleep()期间发送测试消息时.

I tried it with GMail: tested with sleep 60 between the message-processing and IDLE, and IDLE didn't return before timeout even though there were messages; to make sure I didn't miss an event from IDLE, I did a clientside send/recv dump and tried an additional read() before the sending of IDLE after the sleep(); while sending test messaged during the sleep().

使用两个连接,一个用于获取邮件(使用"SEARCH"),另一个用于使用IDLE获取即时的有新消息"事件,这避免了竞争,但是

Using two connections, one for getting the mail (using 'SEARCH') and another for using IDLE to get instant 'there are new messages' events, avoids the race condition, but someone claims there are some problems with that.

推荐答案


如果正确执行的服务器尚未响应其他命令通知您有关新消息的信息,则在您启动IDLE时,它将立即将新消息通知您.

   
A properly implemented server will notify you of the new messages as soon as you start IDLE, if it hasn't already notified you about them in response to some other command.

这篇关于IMAP的idle-search-idle是否存在竞争条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆