aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmd
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-10-09 06:16:02 -0400
committerJesse Luehrs <doy@tozt.net>2019-10-09 06:16:02 -0400
commit4b0513a7da2f5dad582b6d17cef2d530ce9d0489 (patch)
tree025d4220a6018e54eb775a0253c9f978859c86bc /src/cmd
parent04d2a0074ca2bc88d6d8ad3d5e92cd66c4871315 (diff)
downloadteleterm-4b0513a7da2f5dad582b6d17cef2d530ce9d0489.tar.gz
teleterm-4b0513a7da2f5dad582b6d17cef2d530ce9d0489.zip
don't drop the list connection after intentionally quitting watching
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/watch.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/cmd/watch.rs b/src/cmd/watch.rs
index bd54892..1814ad5 100644
--- a/src/cmd/watch.rs
+++ b/src/cmd/watch.rs
@@ -199,10 +199,15 @@ impl WatchSession {
})
}
- fn reconnect(&mut self) -> Result<()> {
+ fn reconnect(&mut self, hard: bool) -> Result<()> {
self.state.logging_in()?;
- self.list_client.reconnect();
self.needs_redraw = true;
+ if hard {
+ self.list_client.reconnect();
+ } else {
+ self.list_client
+ .send_message(crate::protocol::Message::list_sessions());
+ }
Ok(())
}
@@ -323,7 +328,7 @@ impl WatchSession {
stdout.flush().context(FlushTerminal)?;
}
crate::protocol::Message::Disconnected => {
- self.reconnect()?;
+ self.reconnect(true)?;
}
crate::protocol::Message::Error { msg } => {
return Err(Error::Server { message: msg });
@@ -344,7 +349,7 @@ impl WatchSession {
crossterm::InputEvent::Keyboard(crossterm::KeyEvent::Char(
'q',
)) => {
- self.reconnect()?;
+ self.reconnect(false)?;
}
_ => {}
}
@@ -547,7 +552,7 @@ impl WatchSession {
futures::Async::Ready(Some(e)) => {
match e {
crate::client::Event::Disconnect => {
- self.reconnect()?;
+ self.reconnect(true)?;
}
crate::client::Event::Connect(_) => {
self.list_client.send_message(
@@ -586,7 +591,7 @@ impl WatchSession {
futures::Async::Ready(Some(e)) => {
match e {
crate::client::Event::Disconnect => {
- self.reconnect()?;
+ self.reconnect(true)?;
}
crate::client::Event::Connect(_) => {}
crate::client::Event::ServerMessage(msg) => {