Skip to content

feat(server): add bandwidth-measure generation counter - #1963

Open
Greg Lamberson (glamberson) wants to merge 2 commits into
Devolutions:masterfrom
lamco-admin:feat/bandwidth-measure-generation-counter
Open

feat(server): add bandwidth-measure generation counter#1963
Greg Lamberson (glamberson) wants to merge 2 commits into
Devolutions:masterfrom
lamco-admin:feat/bandwidth-measure-generation-counter

Conversation

@glamberson

Copy link
Copy Markdown
Contributor

Summary

  • autodetect_bandwidth_handle() (feat(server): expose measured bandwidth to the embedder #1734) exposes the latest Bandwidth
    Measure figure, but a consumer doing its own smoothing/filtering on
    top of it (e.g. rejecting noisy low samples unless real demand
    existed) needs to know when a new measurement window has closed,
    not just what the figure currently reads. The figure itself is a bad
    freshness signal: a quiet link reads the same low value for several
    consecutive windows in a row, so diffing it cannot tell "fresh
    window, same result" apart from "stale, no new window yet".
  • Adds autodetect_bandwidth_generation, mirroring
    autodetect_bandwidth's exact shape: an Arc<AtomicU32> field,
    autodetect_bandwidth_generation_handle() accessor, and
    with_autodetect_bandwidth_generation_handle() builder method. It
    increments on every completed Bandwidth Measure transaction,
    successful or not — a completed-but-unusable window still needs to
    advance the generation so a consumer's own stale-demand bookkeeping
    gets cleared instead of carrying over into the next window.
  • Along the way, upgrades the existing bandwidth-measured debug log
    from just the computed bandwidth_kbps to also include the
    transaction's raw byte_count/time_delta_ms inputs. Useful on its
    own for anyone diagnosing why the figure looks noisy against a
    bursty traffic source (as this crate's own damage-driven server
    usage does): the raw inputs make it immediately visible whether a
    low reading came from a genuinely idle window or a short one that
    happened to close early.

Validation

cargo xtask check fmt/lints/typos all pass; cargo test -p ironrdp-server --features egfx,helper green (5 passed, 1 ignored,
plus doctests).

Notes

No public API break: both changes are purely additive to
RdpServerBuilder and RdpServer.

bandwidth_kbps alone reads as noise on a damage-driven video source: a
single 1.25s measurement window catches either near-idle traffic (a
handful of cursor/autodetect PDUs, ~1.8KB) or a real EGFX frame landing
in it (tens of KB), so the same unthrottled link reports anywhere from
~11kbps to ~600kbps depending on what the encoder happened to be doing
in that specific window. Logging time_delta_ms/byte_count alongside the
computed figure makes that bimodality visible instead of looking like a
calculation bug -- the formula (byte_count*8/time_delta_ms) was already
correct; the volatility is inherent to counting real traffic over a
short window against a bursty source, not a defect.
The bandwidth figure alone repeats too often to tell a fresh
measurement window apart from a stale one (a quiet link reads the
same low figure for several consecutive windows). Expose a counter
that increments on every completed Bandwidth Measure transaction,
successful or not, so a consumer can gate its own filtering logic on
"a new window just closed" instead of diffing the value itself.
@github-actions github-actions Bot added kind/protocol Affects RDP or related protocol behavior risk/medium Behavioral change that does not substantially alter a core public API size/S Size: up to 199 counted lines and 5 files; exceeds XS in either measure maintainer-required Maintainer review or intervention is required labels Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/protocol Affects RDP or related protocol behavior maintainer-required Maintainer review or intervention is required risk/medium Behavioral change that does not substantially alter a core public API size/S Size: up to 199 counted lines and 5 files; exceeds XS in either measure

Development

Successfully merging this pull request may close these issues.

1 participant