aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-10-15 13:27:08 -0400
committerJesse Luehrs <doy@tozt.net>2019-10-15 15:29:17 -0400
commit113fb3a122c53545b87f233f972e739790b371b8 (patch)
treec67168e527c245c674346f7d975e9d53dd15a039
parenta7231981eb36e17490cca58e2269944135ea8148 (diff)
downloadteleterm-113fb3a122c53545b87f233f972e739790b371b8.tar.gz
teleterm-113fb3a122c53545b87f233f972e739790b371b8.zip
don't send terminal output messages unless we're connected
the server won't be expecting terminal output messages during the process of a login flow, for instance
-rw-r--r--src/cmd/stream.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/stream.rs b/src/cmd/stream.rs
index 3afc9eb..695f54b 100644
--- a/src/cmd/stream.rs
+++ b/src/cmd/stream.rs
@@ -118,6 +118,7 @@ struct StreamSession<
sent_local: usize,
sent_remote: usize,
needs_flush: bool,
+ connected: bool,
done: bool,
raw_screen: Option<crossterm::RawScreen>,
}
@@ -150,6 +151,7 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static>
sent_local: 0,
sent_remote: 0,
needs_flush: false,
+ connected: false,
done: false,
raw_screen: None,
}
@@ -193,6 +195,7 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static>
match self.client.poll() {
Ok(futures::Async::Ready(Some(e))) => match e {
crate::client::Event::Disconnect => {
+ self.connected = false;
Ok(crate::component_future::Poll::DidWork)
}
crate::client::Event::Start(size) => {
@@ -200,6 +203,7 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static>
Ok(crate::component_future::Poll::DidWork)
}
crate::client::Event::Connect() => {
+ self.connected = true;
self.sent_remote = 0;
Ok(crate::component_future::Poll::DidWork)
}
@@ -315,7 +319,7 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static>
fn poll_write_server(
&mut self,
) -> Result<crate::component_future::Poll<()>> {
- if self.sent_remote == self.buffer.len() {
+ if self.sent_remote == self.buffer.len() || !self.connected {
// ship all data to the server before actually ending
if self.done {
return Ok(crate::component_future::Poll::Event(()));