melib/{imap,nntp}: flush after write_all
IMAP IDLE got stuck, because the IDLE connection used `send_raw` that didn't flush output after `write_all`, *if* DEFLATE was on. DEFLATE needs to flush output.memfd
parent
ec0153e7b2
commit
ce45cf5f17
|
@ -142,6 +142,10 @@ impl ImapStream {
|
|||
.chain_err_kind(crate::error::ErrorKind::Network)?;
|
||||
}
|
||||
}
|
||||
socket
|
||||
.flush()
|
||||
.await
|
||||
.chain_err_kind(crate::error::ErrorKind::Network)?;
|
||||
let mut response = String::with_capacity(1024);
|
||||
let mut broken = false;
|
||||
let now = std::time::Instant::now();
|
||||
|
@ -452,6 +456,7 @@ impl ImapStream {
|
|||
if let Err(err) = try_await(async move {
|
||||
self.stream.write_all(data).await?;
|
||||
self.stream.write_all(b"\r\n").await?;
|
||||
self.stream.flush().await?;
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
|
@ -466,6 +471,7 @@ impl ImapStream {
|
|||
if let Err(err) = try_await(async move {
|
||||
self.stream.write_all(raw).await?;
|
||||
self.stream.write_all(b"\r\n").await?;
|
||||
self.stream.flush().await?;
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
|
|
|
@ -138,6 +138,10 @@ impl NntpStream {
|
|||
.write_all(b"STARTTLS\r\n")
|
||||
.await
|
||||
.chain_err_kind(crate::error::ErrorKind::Network)?;
|
||||
ret.stream
|
||||
.flush()
|
||||
.await
|
||||
.chain_err_kind(crate::error::ErrorKind::Network)?;
|
||||
ret.read_response(&mut res, false).await?;
|
||||
if !res.starts_with("382 ") {
|
||||
return Err(MeliError::new(format!(
|
||||
|
|
Loading…
Reference in New Issue