Skip to content

feat(server): add auto-detect RTT measurement#1177

Open
Greg Lamberson (glamberson) wants to merge 2 commits intoDevolutions:masterfrom
lamco-admin:feat/server-autodetect-v2
Open

feat(server): add auto-detect RTT measurement#1177
Greg Lamberson (glamberson) wants to merge 2 commits intoDevolutions:masterfrom
lamco-admin:feat/server-autodetect-v2

Conversation

@glamberson
Copy link
Contributor

Depends on #1176. Related to #1158.

Adds server-side RTT measurement using the protocol-standard auto-detect
mechanism (MS-RDPBCGR 2.2.14), building on the PDU types from #1168.

Auto-detect operates on the IO channel via Share Data PDUs, independent
of the ECHO DVC. This makes it available even when DVC setup fails, and
the protocol also supports bandwidth measurement (not yet implemented)
and connect-time detection for future work.

Changes:

  • AutoDetectManager in ironrdp-server: tracks pending probes, computes
    min/max/avg RTT over a sliding window of 8 samples
  • ServerEvent::AutoDetectRttRequest for triggering probes
  • IO channel handling for AutoDetectRsp
  • enable_autodetect() / rtt_snapshot() public API on RdpServer
  • encode_share_data_pdu() helper for server-initiated Share Data writes
  • 7 integration tests

368 lines, 7 files.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds server-side RTT measurement using MS-RDPBCGR auto-detect PDUs routed through Share Data (IO channel), exposing an opt-in API on RdpServer and validating behavior with new tests.

Changes:

  • Introduces AutoDetectManager to track outstanding RTT probes and compute min/max/avg over a sliding window.
  • Wires auto-detect request/response handling into ironrdp-server (new event + IO channel dispatch) and exports the module publicly.
  • Extends ironrdp-pdu Share Data dispatch/encoding to support auto-detect PDUs and adds integration tests.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
crates/ironrdp-testsuite-core/tests/server/mod.rs Registers new auto-detect server tests module.
crates/ironrdp-testsuite-core/tests/server/autodetect.rs Adds integration tests for sequence, matching, snapshots, wrapping, expiry.
crates/ironrdp-testsuite-core/Cargo.toml Adds ironrdp-server dependency for testsuite usage.
crates/ironrdp-server/src/server.rs Adds opt-in autodetect state, new event to trigger probes, IO-channel handling for responses, and Share Data encoding helper.
crates/ironrdp-server/src/lib.rs Exports the new autodetect module publicly.
crates/ironrdp-server/src/autodetect.rs Implements RTT probe tracking/statistics + unit tests.
crates/ironrdp-pdu/src/rdp/headers.rs Adds ShareDataPdu variants/type for auto-detect and routes decode/encode accordingly.
Cargo.lock Updates workspace lockfile for new dependency edge.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Member

@CBenoit Benoît Cortier (CBenoit) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good to me! Waiting on the Copilot comments to be addressed / dismissed.

Add server-side RTT measurement using the protocol-standard auto-detect
mechanism (MS-RDPBCGR 2.2.14). Depends on Devolutions#1176 for ShareDataPdu routing.

New AutoDetectManager tracks outstanding RTT probes and computes
min/max/avg statistics over a sliding window. Wired into the server
event loop via ServerEvent::AutoDetectRttRequest and IO channel
response handling.

Public API: enable_autodetect() / rtt_snapshot() on RdpServer.
@glamberson
Copy link
Contributor Author

Great, an update is going through my own ci then will hit here. Thanks.

- Fix pdu_source set to io_channel_id instead of user_channel_id in
  encode_share_data_pdu (matches legacy.rs initiator_id convention)
- Fix handle_response accepting any AutoDetectResponse variant; now
  matches only RttResponse via let-else, returns None for others
- Add RTT_PROBE_MAX_AGE constant (30s) and call expire_stale_probes
  before each send to bound pending_probes growth
- Relax timing assertion from <10ms to <100ms for CI stability
- Fix wrap test to resolve each probe immediately, avoiding 65k-entry
  pending_probes allocation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants