imap: don't retry command on reconnection

If a command fails and connection is restarted, don't try the command
again; it only made sense in the previous connection's context.
This commit is contained in:
Manos Pitsidianakis 2020-02-19 17:06:26 +02:00
parent e3abd458ce
commit 9a46e58029
No known key found for this signature in database
GPG Key ID: 73627C2F690DF710

View File

@ -398,13 +398,10 @@ impl ImapConnection {
} else {
*self.online.lock().unwrap() = (Instant::now(), Ok(()));
}
let (capabilities, mut stream) = new_stream?;
let ret = action(&mut stream);
if ret.is_ok() {
let (capabilities, stream) = new_stream?;
self.stream = Ok(stream);
self.capabilities = capabilities;
}
ret
Err(MeliError::new("Connection timed out"))
}
}
@ -476,7 +473,7 @@ impl Iterator for ImapBlockingConnection {
return None;
}
match conn.stream.as_mut().unwrap().stream.read(buf) {
Ok(0) => continue,
Ok(0) => return None,
Ok(b) => {
result.extend_from_slice(&buf[0..b]);
debug!(unsafe { std::str::from_utf8_unchecked(result) });