mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
fix a problem where IDLE would run but miss messages
This commit is contained in:
@@ -52,6 +52,14 @@ impl Imap {
|
|||||||
let mut info = Default::default();
|
let mut info = Default::default();
|
||||||
|
|
||||||
if let Some(session) = self.session.take() {
|
if let Some(session) = self.session.take() {
|
||||||
|
// if we have unsolicited responses we directly return
|
||||||
|
if let Ok(res) = session.unsolicited_responses.try_recv() {
|
||||||
|
warn!(context, "skip idle, got unsolicited response {:?}", res);
|
||||||
|
self.session = Some(session);
|
||||||
|
return Ok(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let mut handle = session.idle();
|
let mut handle = session.idle();
|
||||||
if let Err(err) = handle.init().await {
|
if let Err(err) = handle.init().await {
|
||||||
return Err(Error::IdleProtocolFailed(err));
|
return Err(Error::IdleProtocolFailed(err));
|
||||||
@@ -75,8 +83,8 @@ impl Imap {
|
|||||||
});
|
});
|
||||||
|
|
||||||
match fut.await {
|
match fut.await {
|
||||||
Ok(Event::IdleResponse(IdleResponse::NewData(_))) => {
|
Ok(Event::IdleResponse(IdleResponse::NewData(x))) => {
|
||||||
info!(context, "Idle has NewData");
|
info!(context, "Idle has NewData {:?}", x);
|
||||||
}
|
}
|
||||||
Ok(Event::IdleResponse(IdleResponse::Timeout)) => {
|
Ok(Event::IdleResponse(IdleResponse::Timeout)) => {
|
||||||
info!(context, "Idle-wait timeout or interruption");
|
info!(context, "Idle-wait timeout or interruption");
|
||||||
|
|||||||
Reference in New Issue
Block a user