Set read/write timeouts for IMAP SOCKS5 streams

This commit is contained in:
link2xt
2022-12-09 20:26:27 +00:00
parent 109a27c9ef
commit bccd79b6be
4 changed files with 52 additions and 48 deletions

View File

@@ -48,10 +48,9 @@ impl SessionStream for Pin<Box<TimeoutStream<TcpStream>>> {
self.as_mut().set_read_timeout_pinned(timeout);
}
}
impl SessionStream for Socks5Stream<TcpStream> {
fn set_read_timeout(&mut self, _timeout: Option<Duration>) {
// FIXME: build SOCKS streams on top of TimeoutStream, not directly TcpStream,
// so we can set a read timeout for them.
impl SessionStream for Socks5Stream<Pin<Box<TimeoutStream<TcpStream>>>> {
fn set_read_timeout(&mut self, timeout: Option<Duration>) {
self.get_socket_mut().set_read_timeout(timeout)
}
}