style(host): cargo fmt --all (rustfmt 1.9.0 drift)
The CI image's rustfmt reformats these files (multi-line assert!/tracing! macros, match-arm and struct-variant wrapping) — pre-existing drift that the Format job caught. Reformat to match. Pure formatting; no logic change. main.rs also gets a blank line before a standalone comment so rustfmt stops mis-indenting it as a trailing-comment continuation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -274,7 +274,10 @@ mod tests {
|
|||||||
);
|
);
|
||||||
// No pretty-print newlines anywhere in the element stream, and no whitespace-only text
|
// No pretty-print newlines anywhere in the element stream, and no whitespace-only text
|
||||||
// nodes between any adjacent tags.
|
// nodes between any adjacent tags.
|
||||||
assert!(!xml.contains('\n'), "applist must contain no newlines: {xml}");
|
assert!(
|
||||||
|
!xml.contains('\n'),
|
||||||
|
"applist must contain no newlines: {xml}"
|
||||||
|
);
|
||||||
assert!(
|
assert!(
|
||||||
!xml.contains("> <"),
|
!xml.contains("> <"),
|
||||||
"applist must contain no inter-element spaces: {xml}"
|
"applist must contain no inter-element spaces: {xml}"
|
||||||
|
|||||||
@@ -132,9 +132,9 @@ async fn h_launch(
|
|||||||
return xml(error_xml()).into_response();
|
return xml(error_xml()).into_response();
|
||||||
}
|
}
|
||||||
let req_fp: Option<[u8; 32]> = match &peer {
|
let req_fp: Option<[u8; 32]> = match &peer {
|
||||||
Some(Extension(PeerCertFingerprint(Some(fp)))) => {
|
Some(Extension(PeerCertFingerprint(Some(fp)))) => hex::decode(fp)
|
||||||
hex::decode(fp).ok().and_then(|v| <[u8; 32]>::try_from(v).ok())
|
.ok()
|
||||||
}
|
.and_then(|v| <[u8; 32]>::try_from(v).ok()),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -156,7 +156,9 @@ async fn h_launch(
|
|||||||
GsDecision::Serve => {}
|
GsDecision::Serve => {}
|
||||||
GsDecision::Join((w, h, f)) => {
|
GsDecision::Join((w, h, f)) => {
|
||||||
forced_mode = Some((w, h, f));
|
forced_mode = Some((w, h, f));
|
||||||
tracing::info!("GameStream launch JOIN — admitting at the live session's mode {w}x{h}@{f}");
|
tracing::info!(
|
||||||
|
"GameStream launch JOIN — admitting at the live session's mode {w}x{h}@{f}"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
GsDecision::Reject => {
|
GsDecision::Reject => {
|
||||||
tracing::warn!(
|
tracing::warn!(
|
||||||
|
|||||||
@@ -816,7 +816,10 @@ fn stream_body(
|
|||||||
dropped_batches += 1;
|
dropped_batches += 1;
|
||||||
recover_after_drop = true; // re-anchor the reference chain on the next frame
|
recover_after_drop = true; // re-anchor the reference chain on the next frame
|
||||||
if dropped_batches.is_power_of_two() {
|
if dropped_batches.is_power_of_two() {
|
||||||
tracing::warn!(dropped_batches, "video: pipeline queue full — frame dropped");
|
tracing::warn!(
|
||||||
|
dropped_batches,
|
||||||
|
"video: pipeline queue full — frame dropped"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(std::sync::mpsc::TrySendError::Disconnected(_)) => {
|
Err(std::sync::mpsc::TrySendError::Disconnected(_)) => {
|
||||||
@@ -1019,8 +1022,14 @@ mod tests {
|
|||||||
let (chunk, steps) = pace_layout(n);
|
let (chunk, steps) = pace_layout(n);
|
||||||
assert!(steps >= 1, "n={n}: at least one step");
|
assert!(steps >= 1, "n={n}: at least one step");
|
||||||
assert!(steps <= 12, "n={n}: step count {steps} exceeded the cap");
|
assert!(steps <= 12, "n={n}: step count {steps} exceeded the cap");
|
||||||
assert!(chunk >= 16, "n={n}: chunk {chunk} below the 16-packet floor");
|
assert!(
|
||||||
assert!(chunk * steps >= n, "n={n}: {chunk}×{steps} must cover all packets");
|
chunk >= 16,
|
||||||
|
"n={n}: chunk {chunk} below the 16-packet floor"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
chunk * steps >= n,
|
||||||
|
"n={n}: {chunk}×{steps} must cover all packets"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// Small frames stay on the floor: one 16-packet burst.
|
// Small frames stay on the floor: one 16-packet burst.
|
||||||
assert_eq!(pace_layout(1), (16, 1));
|
assert_eq!(pace_layout(1), (16, 1));
|
||||||
|
|||||||
@@ -515,6 +515,7 @@ fn input_test() -> Result<()> {
|
|||||||
fn parse_serve(args: &[String]) -> Result<(mgmt::Options, punktfunk1::NativeServe, bool)> {
|
fn parse_serve(args: &[String]) -> Result<(mgmt::Options, punktfunk1::NativeServe, bool)> {
|
||||||
let mut opts = mgmt::Options::default();
|
let mut opts = mgmt::Options::default();
|
||||||
let mut native_port: u16 = 9777; // the native plane always runs now
|
let mut native_port: u16 = 9777; // the native plane always runs now
|
||||||
|
|
||||||
// Fixed data-plane UDP port: `Some(p)` binds p and streams direct (no hole-punch, no ~2.5 s
|
// Fixed data-plane UDP port: `Some(p)` binds p and streams direct (no hole-punch, no ~2.5 s
|
||||||
// punch-timeout on a firewalled host); `None` (default) = a random port + hole-punch. Env
|
// punch-timeout on a firewalled host); `None` (default) = a random port + hole-punch. Env
|
||||||
// default, `--data-port` overrides.
|
// default, `--data-port` overrides.
|
||||||
|
|||||||
@@ -995,7 +995,9 @@ async fn serve_session(
|
|||||||
|
|
||||||
let start = Start::decode(&io::read_msg(&mut recv).await?)
|
let start = Start::decode(&io::read_msg(&mut recv).await?)
|
||||||
.map_err(|e| anyhow!("Start decode: {e:?}"))?;
|
.map_err(|e| anyhow!("Start decode: {e:?}"))?;
|
||||||
Ok::<_, anyhow::Error>((hello, welcome, udp_port, data_sock, direct, start, compositor))
|
Ok::<_, anyhow::Error>((
|
||||||
|
hello, welcome, udp_port, data_sock, direct, start, compositor,
|
||||||
|
))
|
||||||
};
|
};
|
||||||
let (hello, welcome, udp_port, data_sock, direct, start, compositor) =
|
let (hello, welcome, udp_port, data_sock, direct, start, compositor) =
|
||||||
tokio::time::timeout(HANDSHAKE_TIMEOUT, handshake)
|
tokio::time::timeout(HANDSHAKE_TIMEOUT, handshake)
|
||||||
@@ -1206,11 +1208,20 @@ async fn serve_session(
|
|||||||
let _live_guard = {
|
let _live_guard = {
|
||||||
let id = endpoint::peer_fingerprint(&conn);
|
let id = endpoint::peer_fingerprint(&conn);
|
||||||
let label = id
|
let label = id
|
||||||
.map(|fp| fp.iter().take(4).map(|b| format!("{b:02x}")).collect::<String>())
|
.map(|fp| {
|
||||||
|
fp.iter()
|
||||||
|
.take(4)
|
||||||
|
.map(|b| format!("{b:02x}"))
|
||||||
|
.collect::<String>()
|
||||||
|
})
|
||||||
.unwrap_or_else(|| "client".to_string());
|
.unwrap_or_else(|| "client".to_string());
|
||||||
crate::vdisplay::admission::register(
|
crate::vdisplay::admission::register(
|
||||||
id,
|
id,
|
||||||
(welcome.mode.width, welcome.mode.height, welcome.mode.refresh_hz),
|
(
|
||||||
|
welcome.mode.width,
|
||||||
|
welcome.mode.height,
|
||||||
|
welcome.mode.refresh_hz,
|
||||||
|
),
|
||||||
stop.clone(),
|
stop.clone(),
|
||||||
label,
|
label,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -364,7 +364,10 @@ fn other_enabled_outputs() -> Vec<String> {
|
|||||||
/// then sets itself primary — the pre-group behavior). Recent kscreen marks the primary with
|
/// then sets itself primary — the pre-group behavior). Recent kscreen marks the primary with
|
||||||
/// `"priority": 1`; older builds used a `"primary": true` bool — accept either.
|
/// `"priority": 1`; older builds used a `"primary": true` bool — accept either.
|
||||||
fn a_managed_output_is_primary() -> bool {
|
fn a_managed_output_is_primary() -> bool {
|
||||||
let Ok(out) = std::process::Command::new("kscreen-doctor").arg("-j").output() else {
|
let Ok(out) = std::process::Command::new("kscreen-doctor")
|
||||||
|
.arg("-j")
|
||||||
|
.output()
|
||||||
|
else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
let Ok(doc) = serde_json::from_slice::<serde_json::Value>(&out.stdout) else {
|
let Ok(doc) = serde_json::from_slice::<serde_json::Value>(&out.stdout) else {
|
||||||
|
|||||||
@@ -129,14 +129,22 @@ impl Monitor {
|
|||||||
|
|
||||||
enum MgrState {
|
enum MgrState {
|
||||||
Idle,
|
Idle,
|
||||||
Active { mon: Monitor, refs: u32 },
|
Active {
|
||||||
Lingering { mon: Monitor, until: Instant },
|
mon: Monitor,
|
||||||
|
refs: u32,
|
||||||
|
},
|
||||||
|
Lingering {
|
||||||
|
mon: Monitor,
|
||||||
|
until: Instant,
|
||||||
|
},
|
||||||
/// `keep_alive = forever` (gaming-rig): the monitor is kept indefinitely after the last session
|
/// `keep_alive = forever` (gaming-rig): the monitor is kept indefinitely after the last session
|
||||||
/// leaves — like `Lingering` but the linger timer never tears it down. A reconnect preempts +
|
/// leaves — like `Lingering` but the linger timer never tears it down. A reconnect preempts +
|
||||||
/// recreates it (same as `Lingering`, since a reused IddCx swap-chain is dead); only the mgmt
|
/// recreates it (same as `Lingering`, since a reused IddCx swap-chain is dead); only the mgmt
|
||||||
/// `/display/release` (or host shutdown) frees it. The physical screens stay off (exclusive) for
|
/// `/display/release` (or host shutdown) frees it. The physical screens stay off (exclusive) for
|
||||||
/// the box's life — the §8 release-now escape hatch (`force_release`) is the way back.
|
/// the box's life — the §8 release-now escape hatch (`force_release`) is the way back.
|
||||||
Pinned { mon: Monitor },
|
Pinned {
|
||||||
|
mon: Monitor,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The manager's control-device cache. Reopenable: a driver upgrade / WUDFHost restart kills the
|
/// The manager's control-device cache. Reopenable: a driver upgrade / WUDFHost restart kills the
|
||||||
|
|||||||
Reference in New Issue
Block a user