jonhoo / jonhoo/rust-imap

Wrongful IDLE timeout reset on response

Open
#300 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
583
Forks
94
PR merge metrics
No merged PRs in 30d

Description

I'm connecting to an IMAP server that boots IDLE connections after 30 minutes. I'm using imap-3.0.0-alpha.14, pretty much straight forward
```rust
let imap = client.login(username, password)?;
let mbox = imap.select(inbox)?;
imap.idle().wait_while(|response| { ... });
```
I works well, apart from getting booted periodically.

I believe the issue may be, that the time is not counted from the start of the IDLE loop, but for every read, since the timeout is implemented by calling [`TcpStream::set_read_timeout()`](https://github.com/jonhoo/rust-imap/blob/6fe22ed11a1ccffe1799a73f48e589366d8d100f/src/extensions/idle.rs#L257) [once before the loop](https://github.com/jonhoo/rust-imap/blob/6fe22ed11a1ccffe1799a73f48e589366d8d100f/src/extensions/idle.rs#L236). So when a response arrives on the client, the timeout is effectively reset.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.