melib/imap: ensure connection is alive before fetching bytes/flags

memfd
Manos Pitsidianakis 2020-09-15 01:18:48 +03:00
parent 3b10fa3895
commit a5b6f29f2b
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 2 additions and 0 deletions

View File

@ -67,6 +67,7 @@ impl BackendOp for ImapOp {
let mut response = String::with_capacity(8 * 1024);
{
let mut conn = timeout(uid_store.timeout, connection.lock()).await?;
conn.connect().await?;
conn.examine_mailbox(mailbox_hash, &mut response, false)
.await?;
conn.send_command(format!("UID FETCH {} (FLAGS RFC822)", uid).as_bytes())
@ -127,6 +128,7 @@ impl BackendOp for ImapOp {
};
if !exists_in_cache {
let mut conn = connection.lock().await;
conn.connect().await?;
conn.examine_mailbox(mailbox_hash, &mut response, false)
.await?;
conn.send_command(format!("UID FETCH {} FLAGS", uid).as_bytes())