Trace ticket reattach recovery
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / remote-bench (push) Waiting to run
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / remote-bench (push) Waiting to run
This commit is contained in:
+36
-2
@@ -1463,6 +1463,7 @@ async fn handle_ticket_attach(
|
||||
peer: SocketAddr,
|
||||
body: Vec<u8>,
|
||||
) -> Result<()> {
|
||||
dosh::trace::event("server.ticket_attach_start", &[("peer", peer.to_string())]);
|
||||
let env: TicketAttachEnvelope = protocol::from_body(&body)?;
|
||||
let opened = {
|
||||
let locked = state.lock().expect("server state poisoned");
|
||||
@@ -1486,10 +1487,22 @@ async fn handle_ticket_attach(
|
||||
};
|
||||
let (ticket, request_plain) = match 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)?;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1560,7 +1573,18 @@ async fn handle_ticket_attach(
|
||||
};
|
||||
let (client_id, output_seq, snapshot) = match 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 {
|
||||
@@ -1591,6 +1615,16 @@ async fn handle_ticket_attach(
|
||||
let body = protocol::to_body(&envelope)?;
|
||||
let out = protocol::encode_plain(PacketKind::AttachOk, client_id, 1, 0, &body)?;
|
||||
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(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user