Wire ALPN yumush/3 → yumush/4 since Hello gained build/install
Browse files at this commit14a11c9c139087be6032ec5a03ef407cbf7c54adParent: 7a892d6- fix
- wire ALPN yumush/3 → yumush/4 since Hello gained build/install
- stale clients were rejected with a bitcode decode error and retried every ~8s. Outdated/banned links now show the error alone, without the Reconnecting spinner
3 changed files +15 -7
- crates/client/src/gui.rs +13 -5
- crates/client/src/net/fail.rs +1 -1
- crates/common/src/transport.rs +1 -1
crates/client/src/gui.rsmodified+13 -5
| @@ -26,7 +26,9 @@ use gpui_kit::{ | |||
| 26 | notification::Notification, | 26 | notification::Notification, |
| 27 | spinner::Spinner, | 27 | spinner::Spinner, |
| 28 | }, | 28 | }, |
| 29 | - div, img, px, rems, | 29 | + div, img, |
| 30 | + prelude::FluentBuilder as _, | ||
| 31 | + px, rems, | ||
| 30 | }; | 32 | }; |
| 31 | use jiff::{Timestamp, tz::TimeZone}; | 33 | use jiff::{Timestamp, tz::TimeZone}; |
| 32 | use tokio::sync::mpsc; | 34 | use tokio::sync::mpsc; |
| @@ -545,6 +547,7 @@ enum Connection { | |||
| 545 | Connecting, | 547 | Connecting, |
| 546 | Connected, | 548 | Connected, |
| 547 | Lost { error: String, attempts: u32 }, | 549 | Lost { error: String, attempts: u32 }, |
| 550 | + Failed(String), | ||
| 548 | } | 551 | } |
| 549 | 552 | ||
| 550 | impl Connection { | 553 | impl Connection { |
| @@ -553,6 +556,10 @@ impl Connection { | |||
| 553 | } | 556 | } |
| 554 | 557 | ||
| 555 | fn lost(&mut self, error: &LinkError) { | 558 | fn lost(&mut self, error: &LinkError) { |
| 559 | + if error.terminal() { | ||
| 560 | + *self = Self::Failed(error.to_string()); | ||
| 561 | + return; | ||
| 562 | + } | ||
| 556 | let attempts = match self { | 563 | let attempts = match self { |
| 557 | Self::Lost { attempts, .. } => *attempts + 1, | 564 | Self::Lost { attempts, .. } => *attempts + 1, |
| 558 | _ => 1, | 565 | _ => 1, |
| @@ -565,12 +572,13 @@ impl Connection { | |||
| 565 | } | 572 | } |
| 566 | 573 | ||
| 567 | fn connection_notice(connection: &Connection, palette: Palette) -> Option<Div> { | 574 | fn connection_notice(connection: &Connection, palette: Palette) -> Option<Div> { |
| 568 | - let (label, color) = match connection { | 575 | + let (label, color, busy) = match connection { |
| 569 | - Connection::Connecting => (w().gui.connecting.to_string(), palette.muted), | 576 | + Connection::Connecting => (w().gui.connecting.to_string(), palette.muted, true), |
| 570 | Connection::Connected => return None, | 577 | Connection::Connected => return None, |
| 571 | Connection::Lost { error, attempts } => { | 578 | Connection::Lost { error, attempts } => { |
| 572 | - (w().gui.reconnecting(attempts, error), palette.alert) | 579 | + (w().gui.reconnecting(attempts, error), palette.alert, true) |
| 573 | } | 580 | } |
| 581 | + Connection::Failed(error) => (error.clone(), palette.alert, false), | ||
| 574 | }; | 582 | }; |
| 575 | Some( | 583 | Some( |
| 576 | div() | 584 | div() |
| @@ -581,7 +589,7 @@ fn connection_notice(connection: &Connection, palette: Palette) -> Option<Div> { | |||
| 581 | .gap(px(space::SM)) | 589 | .gap(px(space::SM)) |
| 582 | .text_size(text(style::text::CAPTION)) | 590 | .text_size(text(style::text::CAPTION)) |
| 583 | .text_color(color) | 591 | .text_color(color) |
| 584 | - .child(Spinner::new().xsmall().color(color)) | 592 | + .when(busy, |row| row.child(Spinner::new().xsmall().color(color))) |
| 585 | .child(label), | 593 | .child(label), |
| 586 | ) | 594 | ) |
| 587 | } | 595 | } |
crates/client/src/net/fail.rsmodified+1 -1
| @@ -27,7 +27,7 @@ impl std::fmt::Display for LinkError { | |||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | impl LinkError { | 29 | impl LinkError { |
| 30 | - pub(super) fn terminal(self) -> bool { | 30 | + pub fn terminal(self) -> bool { |
| 31 | matches!(self, Self::Outdated | Self::Closed(Close::Banned)) | 31 | matches!(self, Self::Outdated | Self::Closed(Close::Banned)) |
| 32 | } | 32 | } |
| 33 | 33 | ||
crates/common/src/transport.rsmodified+1 -1
| @@ -13,7 +13,7 @@ use quinn::{ | |||
| 13 | use quinn_proto::RttEstimator; | 13 | use quinn_proto::RttEstimator; |
| 14 | use socket2::{Domain, Protocol, Socket, Type}; | 14 | use socket2::{Domain, Protocol, Socket, Type}; |
| 15 | 15 | ||
| 16 | -pub const ALPN: &[u8] = b"yumush/3"; | 16 | +pub const ALPN: &[u8] = b"yumush/4"; |
| 17 | 17 | ||
| 18 | const IDLE_TIMEOUT: Duration = Duration::from_secs(10); | 18 | const IDLE_TIMEOUT: Duration = Duration::from_secs(10); |
| 19 | pub const KEEP_ALIVE: Duration = Duration::from_secs(1); | 19 | pub const KEEP_ALIVE: Duration = Duration::from_secs(1); |