diff --git a/crates/client/src/gui.rs b/crates/client/src/gui.rs
index 837277e..5f60c0f 100644
--- a/crates/client/src/gui.rs
+++ b/crates/client/src/gui.rs
@@ -26,7 +26,9 @@ use gpui_kit::{
notification::Notification,
spinner::Spinner,
},
- div, img, px, rems,
+ div, img,
+ prelude::FluentBuilder as _,
+ px, rems,
};
use jiff::{Timestamp, tz::TimeZone};
use tokio::sync::mpsc;
@@ -545,6 +547,7 @@ enum Connection {
Connecting,
Connected,
Lost { error: String, attempts: u32 },
+ Failed(String),
}
impl Connection {
@@ -553,6 +556,10 @@ impl Connection {
}
fn lost(&mut self, error: &LinkError) {
+ if error.terminal() {
+ *self = Self::Failed(error.to_string());
+ return;
+ }
let attempts = match self {
Self::Lost { attempts, .. } => *attempts + 1,
_ => 1,
@@ -565,12 +572,13 @@ impl Connection {
}
fn connection_notice(connection: &Connection, palette: Palette) -> Option
{
- let (label, color) = match connection {
- Connection::Connecting => (w().gui.connecting.to_string(), palette.muted),
+ let (label, color, busy) = match connection {
+ Connection::Connecting => (w().gui.connecting.to_string(), palette.muted, true),
Connection::Connected => return None,
Connection::Lost { error, attempts } => {
- (w().gui.reconnecting(attempts, error), palette.alert)
+ (w().gui.reconnecting(attempts, error), palette.alert, true)
}
+ Connection::Failed(error) => (error.clone(), palette.alert, false),
};
Some(
div()
@@ -581,7 +589,7 @@ fn connection_notice(connection: &Connection, palette: Palette) -> Option
{
.gap(px(space::SM))
.text_size(text(style::text::CAPTION))
.text_color(color)
- .child(Spinner::new().xsmall().color(color))
+ .when(busy, |row| row.child(Spinner::new().xsmall().color(color)))
.child(label),
)
}
diff --git a/crates/client/src/net/fail.rs b/crates/client/src/net/fail.rs
index 4d3cdc6..45f72f0 100644
--- a/crates/client/src/net/fail.rs
+++ b/crates/client/src/net/fail.rs
@@ -27,7 +27,7 @@ impl std::fmt::Display for LinkError {
}
impl LinkError {
- pub(super) fn terminal(self) -> bool {
+ pub fn terminal(self) -> bool {
matches!(self, Self::Outdated | Self::Closed(Close::Banned))
}
diff --git a/crates/common/src/transport.rs b/crates/common/src/transport.rs
index 36b851c..d398cb1 100644
--- a/crates/common/src/transport.rs
+++ b/crates/common/src/transport.rs
@@ -13,7 +13,7 @@ use quinn::{
use quinn_proto::RttEstimator;
use socket2::{Domain, Protocol, Socket, Type};
-pub const ALPN: &[u8] = b"yumush/3";
+pub const ALPN: &[u8] = b"yumush/4";
const IDLE_TIMEOUT: Duration = Duration::from_secs(10);
pub const KEEP_ALIVE: Duration = Duration::from_secs(1);