fixup laggy mux connections for recent idle changes
in the same vein as d657721163
this commit introduces more assertive signalling from the remote
mux when a pane is closed so that the client can update.
This commit is contained in:
1 parent
d657721163
commit
257d323062
7 files changed
+26
-5
No files matched your search
@@ -436,6 +436,7 @@ pdu! {
|
||||
SplitPane: 34,
|
||||
KillPane: 35,
|
||||
SpawnV2: 36,
|
||||
PaneRemoved: 37,
|
||||
}
|
||||
|
||||
impl Pdu {
|
||||
@@ -511,6 +512,7 @@ impl Pdu {
|
||||
Some(*pane_id)
|
||||
}
|
||||
Pdu::SetClipboard(SetClipboard { pane_id, .. }) => Some(*pane_id),
|
||||
Pdu::PaneRemoved(PaneRemoved { pane_id }) => Some(*pane_id),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -589,6 +591,11 @@ pub struct SpawnV2 {
|
||||
pub size: PtySize,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, PartialEq, Debug)]
|
||||
pub struct PaneRemoved {
|
||||
pub pane_id: PaneId,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, PartialEq, Debug)]
|
||||
pub struct KillPane {
|
||||
pub pane_id: PaneId,
|
||||
|
||||
@@ -36,6 +36,7 @@ use crate::activity::Activity;
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum MuxNotification {
|
||||
PaneOutput(PaneId),
|
||||
PaneRemoved(PaneId),
|
||||
WindowCreated(WindowId),
|
||||
WindowInvalidated(WindowId),
|
||||
Alert {
|
||||
@@ -383,6 +384,7 @@ impl Mux {
|
||||
if let Some(pane) = self.panes.borrow_mut().remove(&pane_id) {
|
||||
log::debug!("killing pane {}", pane_id);
|
||||
pane.kill();
|
||||
self.notify(MuxNotification::PaneRemoved(pane_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,12 @@ impl ClientPane {
|
||||
log::error!("ClientPane: Ignoring SetClipboard request {:?}", clipboard);
|
||||
}
|
||||
},
|
||||
Pdu::PaneRemoved(PaneRemoved { pane_id }) => {
|
||||
log::trace!("remote pane {} has been removed", pane_id);
|
||||
self.renderable.borrow().inner.borrow_mut().dead = true;
|
||||
let mux = mux::Mux::get().unwrap();
|
||||
mux.prune_dead_windows();
|
||||
}
|
||||
_ => bail!("unhandled unilateral pdu: {:?}", pdu),
|
||||
};
|
||||
Ok(())
|
||||
|
||||
@@ -347,11 +347,9 @@ impl RenderableInner {
|
||||
dirty.remove(stable_row);
|
||||
}
|
||||
|
||||
if !dirty.is_empty() {
|
||||
Mux::get()
|
||||
.unwrap()
|
||||
.notify(mux::MuxNotification::PaneOutput(self.local_pane_id));
|
||||
}
|
||||
Mux::get()
|
||||
.unwrap()
|
||||
.notify(mux::MuxNotification::PaneOutput(self.local_pane_id));
|
||||
|
||||
let mut to_fetch = RangeSet::new();
|
||||
for r in dirty.iter() {
|
||||
|
||||
@@ -38,6 +38,7 @@ impl GuiFrontEnd {
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
MuxNotification::PaneRemoved(_) => {}
|
||||
MuxNotification::WindowInvalidated(_) => {}
|
||||
MuxNotification::PaneOutput(_) => {}
|
||||
MuxNotification::Alert {
|
||||
|
||||
@@ -81,6 +81,12 @@ where
|
||||
Ok(Item::Notif(MuxNotification::PaneOutput(pane_id))) => {
|
||||
handler.schedule_pane_push(pane_id);
|
||||
}
|
||||
Ok(Item::Notif(MuxNotification::PaneRemoved(pane_id))) => {
|
||||
Pdu::PaneRemoved(codec::PaneRemoved { pane_id })
|
||||
.encode_async(&mut stream, 0)
|
||||
.await?;
|
||||
stream.flush().await.context("flushing PDU to client")?;
|
||||
}
|
||||
Ok(Item::Notif(MuxNotification::Alert { pane_id, alert: _ })) => {
|
||||
// FIXME: queue notification to send to client!
|
||||
handler.schedule_pane_push(pane_id);
|
||||
|
||||
@@ -532,6 +532,7 @@ impl SessionHandler {
|
||||
| Pdu::GetLinesResponse { .. }
|
||||
| Pdu::GetCodecVersionResponse { .. }
|
||||
| Pdu::GetTlsCredsResponse { .. }
|
||||
| Pdu::PaneRemoved { .. }
|
||||
| Pdu::ErrorResponse { .. } => {
|
||||
send_response(Err(anyhow!("expected a request, got {:?}", decoded.pdu)))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user