Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d5bb126c5 | |||
| 37632a96b7 | |||
| e69be4fdf0 | |||
| fdbd58b628 | |||
| c65aba9d7a | |||
| 818b481154 | |||
| 70650e221b | |||
| 01e8870578 | |||
| 99d54899bd |
Generated
+1
-1
@@ -436,7 +436,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dosh"
|
name = "dosh"
|
||||||
version = "1.0.0-rc29"
|
version = "1.0.0-rc37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64",
|
"base64",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dosh"
|
name = "dosh"
|
||||||
version = "1.0.0-rc29"
|
version = "1.0.0-rc37"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
|||||||
@@ -73,12 +73,26 @@ File copy must be enabled by the server config.
|
|||||||
For terminal/reconnect bugs, run a client with:
|
For terminal/reconnect bugs, run a client with:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
DOSH_TRACE=/tmp/dosh-client.log DOSH_TRACE_BYTES=1 dosh HOST
|
dosh trace HOST
|
||||||
```
|
```
|
||||||
|
|
||||||
Set `DOSH_TRACE=/tmp/dosh-server.log` on `dosh-server` for matching server
|
The client log path is printed before the session starts. To choose it:
|
||||||
events. `DOSH_TRACE_BYTES=1` records byte prefixes, so use it only for short
|
|
||||||
reproductions.
|
```sh
|
||||||
|
dosh trace --client-log /tmp/dosh-client.log HOST
|
||||||
|
```
|
||||||
|
|
||||||
|
Summarize collected traces with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
dosh trace report HOST --client-log /tmp/dosh-client.log
|
||||||
|
```
|
||||||
|
|
||||||
|
When `HOST` is given, Dosh fetches `/tmp/dosh-server.log` over SSH before
|
||||||
|
building the report. Set `DOSH_TRACE=/tmp/dosh-server.log` on `dosh-server` for
|
||||||
|
matching server events. Reports default to the latest traced client/server
|
||||||
|
process run; add `--all-runs` to include older appended log entries. Trace byte
|
||||||
|
prefixes are enabled for `dosh trace`, so use it only for short reproductions.
|
||||||
|
|
||||||
## VS Code
|
## VS Code
|
||||||
|
|
||||||
|
|||||||
+1402
-35
File diff suppressed because it is too large
Load Diff
+43
-2
@@ -200,6 +200,13 @@ async fn serve(config_path: Option<std::path::PathBuf>) -> Result<()> {
|
|||||||
.with_context(|| format!("bind {bind}"))?,
|
.with_context(|| format!("bind {bind}"))?,
|
||||||
);
|
);
|
||||||
eprintln!("dosh-server listening on {bind}");
|
eprintln!("dosh-server listening on {bind}");
|
||||||
|
dosh::trace::event(
|
||||||
|
"server.start",
|
||||||
|
&[
|
||||||
|
("version", dosh::build_info::VERSION.to_string()),
|
||||||
|
("bind", bind.clone()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
let (pty_tx, mut pty_rx) = mpsc::unbounded_channel();
|
let (pty_tx, mut pty_rx) = mpsc::unbounded_channel();
|
||||||
let state = Arc::new(Mutex::new(ServerState::new(
|
let state = Arc::new(Mutex::new(ServerState::new(
|
||||||
@@ -1456,6 +1463,7 @@ async fn handle_ticket_attach(
|
|||||||
peer: SocketAddr,
|
peer: SocketAddr,
|
||||||
body: Vec<u8>,
|
body: Vec<u8>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
dosh::trace::event("server.ticket_attach_start", &[("peer", peer.to_string())]);
|
||||||
let env: TicketAttachEnvelope = protocol::from_body(&body)?;
|
let env: TicketAttachEnvelope = protocol::from_body(&body)?;
|
||||||
let opened = {
|
let opened = {
|
||||||
let locked = state.lock().expect("server state poisoned");
|
let locked = state.lock().expect("server state poisoned");
|
||||||
@@ -1479,10 +1487,22 @@ async fn handle_ticket_attach(
|
|||||||
};
|
};
|
||||||
let (ticket, request_plain) = match opened {
|
let (ticket, request_plain) = match opened {
|
||||||
Ok(opened) => opened,
|
Ok(opened) => opened,
|
||||||
Err(err) => return send_reject(socket, peer, &err.to_string()).await,
|
Err(err) => {
|
||||||
|
let reason = err.to_string();
|
||||||
|
dosh::trace::event("server.ticket_attach_reject", &[("reason", reason.clone())]);
|
||||||
|
return send_reject(socket, peer, &reason).await;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let req: TicketAttachBody = protocol::from_body(&request_plain)?;
|
let req: TicketAttachBody = protocol::from_body(&request_plain)?;
|
||||||
if req.session != ticket.session || req.mode != ticket.mode {
|
if req.session != ticket.session || req.mode != ticket.mode {
|
||||||
|
dosh::trace::event(
|
||||||
|
"server.ticket_attach_reject",
|
||||||
|
&[
|
||||||
|
("session", req.session.clone()),
|
||||||
|
("mode", req.mode.clone()),
|
||||||
|
("reason", "ticket scope mismatch".to_string()),
|
||||||
|
],
|
||||||
|
);
|
||||||
return send_reject(socket, peer, "ticket scope mismatch").await;
|
return send_reject(socket, peer, "ticket scope mismatch").await;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1553,7 +1573,18 @@ async fn handle_ticket_attach(
|
|||||||
};
|
};
|
||||||
let (client_id, output_seq, snapshot) = match attached {
|
let (client_id, output_seq, snapshot) = match attached {
|
||||||
Ok(attached) => attached,
|
Ok(attached) => attached,
|
||||||
Err(err) => return send_reject(socket, peer, &err.to_string()).await,
|
Err(err) => {
|
||||||
|
let reason = err.to_string();
|
||||||
|
dosh::trace::event(
|
||||||
|
"server.ticket_attach_reject",
|
||||||
|
&[
|
||||||
|
("session", req.session.clone()),
|
||||||
|
("mode", req.mode.clone()),
|
||||||
|
("reason", reason.clone()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
return send_reject(socket, peer, &reason).await;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let ok = AttachOk {
|
let ok = AttachOk {
|
||||||
@@ -1584,6 +1615,16 @@ async fn handle_ticket_attach(
|
|||||||
let body = protocol::to_body(&envelope)?;
|
let body = protocol::to_body(&envelope)?;
|
||||||
let out = protocol::encode_plain(PacketKind::AttachOk, client_id, 1, 0, &body)?;
|
let out = protocol::encode_plain(PacketKind::AttachOk, client_id, 1, 0, &body)?;
|
||||||
let _ = send_udp(socket, &out, peer).await?;
|
let _ = send_udp(socket, &out, peer).await?;
|
||||||
|
dosh::trace::event(
|
||||||
|
"server.ticket_attach_ok",
|
||||||
|
&[
|
||||||
|
("session", ok.session.clone()),
|
||||||
|
("mode", ok.mode.clone()),
|
||||||
|
("client", hex_id(client_id)),
|
||||||
|
("output_seq", output_seq.to_string()),
|
||||||
|
("bytes", ok.snapshot.len().to_string()),
|
||||||
|
],
|
||||||
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user