From 0b6b8536626ee90d99fef221417fd3bdcd80d21c Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Sun, 21 Feb 2021 07:48:11 -0600 Subject: [PATCH] WOW accidentally left a read_line statement in there, caused all the problems... --- imap/src/client/inner.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/imap/src/client/inner.rs b/imap/src/client/inner.rs index 345ad8b..44fd01f 100644 --- a/imap/src/client/inner.rs +++ b/imap/src/client/inner.rs @@ -97,6 +97,7 @@ where let cmd_str = format!("{}{} {}\r\n", TAG_PREFIX, id, cmd); debug!("[{}] writing to socket: {:?}", id, cmd_str); self.conn.write_all(cmd_str.as_bytes()).await?; + self.conn.flush().await?; debug!("[{}] written.", id); ExecHandle(self, id).await; @@ -215,6 +216,7 @@ where match future::select(fut, fut2).await { Either::Left((_, _)) => { + debug!("got a new line"); let next_line = next_line.trim_end_matches('\n').trim_end_matches('\r'); let mut parts = next_line.split(" "); @@ -223,6 +225,8 @@ where if tag == "*" { debug!("UNTAGGED {:?}", rest); + + // TODO: verify that the greeting is actually an OK if let Some(greeting) = greeting.take() { let (greeting, waker) = &mut *greeting.write(); debug!("got greeting"); @@ -249,8 +253,6 @@ where break; } } - - reader.read_line(&mut next_line).await?; } let conn = reader.into_inner();