melib/imap: set 9min tcp keepalive on connection

memfd
Manos Pitsidianakis 2020-09-15 01:17:55 +03:00
parent 42c4c61518
commit 3b10fa3895
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 9 additions and 0 deletions

View File

@ -253,6 +253,15 @@ impl ImapStream {
))
.chain_err_kind(crate::error::ErrorKind::Network)?
};
if let Err(err) = stream
.get_ref()
.set_keepalive(Some(Duration::new(60 * 9, 0)))
{
crate::log(
format!("Could not set TCP keepalive in IMAP connection: {}", err),
crate::LoggingLevel::WARN,
);
}
let mut res = String::with_capacity(8 * 1024);
let mut ret = ImapStream {
cmd_id,