remote server: Do not spawn server when proxy reconnects (#18864)
This ensures that we only ever reconnect to a running server and not spawn a new server with no state. This avoids the problem of the server process crashing, `proxy` reconnecting, starting a new server, and the user getting errors like "unknown buffer id: ...". Release Notes: - N/A --------- Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
This commit is contained in:
parent
dbf986d37a
commit
c674d73734
7 changed files with 248 additions and 91 deletions
25
crates/remote/src/proxy.rs
Normal file
25
crates/remote/src/proxy.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ProxyLaunchError {
|
||||
#[error("Attempted reconnect, but server not running.")]
|
||||
ServerNotRunning,
|
||||
}
|
||||
|
||||
impl ProxyLaunchError {
|
||||
pub fn to_exit_code(&self) -> i32 {
|
||||
match self {
|
||||
// We're using 90 as the exit code, because 0-78 are often taken
|
||||
// by shells and other conventions and >128 also has certain meanings
|
||||
// in certain contexts.
|
||||
Self::ServerNotRunning => 90,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_exit_code(exit_code: i32) -> Option<Self> {
|
||||
match exit_code {
|
||||
90 => Some(Self::ServerNotRunning),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue