Skip to content

feat(connector): surface ShareDataPdu variant in unexpected-PDU errors#1329

Open
Greg Lamberson (glamberson) wants to merge 1 commit into
Devolutions:masterfrom
lamco-admin:feat/connector-share-data-pdu-drill-down
Open

feat(connector): surface ShareDataPdu variant in unexpected-PDU errors#1329
Greg Lamberson (glamberson) wants to merge 1 commit into
Devolutions:masterfrom
lamco-admin:feat/connector-share-data-pdu-drill-down

Conversation

@glamberson
Copy link
Copy Markdown
Contributor

@glamberson Greg Lamberson (glamberson) commented May 27, 2026

Summary

  • Addresses ask 1 of Surface the actual Share Control PDU type when 'unexpected Share Control Pdu' fires #1232: when the server sends a ShareControlPdu::Data wrapping an unexpected ShareDataPdu, the three error sites in legacy.rs and connection_activation.rs now drill into the Data wrapper and surface the inner variant name instead of reporting only "Data".
  • For ServerSetErrorInfo specifically (the asker's high-value case), the existing ErrorInfo::description() is appended so callers can see why the server rejected the session without substring matching on the Reason string.
  • New pub(crate) fn describe_unexpected_share_control_pdu in legacy.rs centralizes the formatting; decode_share_data, decode_io_channel, and ConnectionActivation::CapabilitiesExchange all route through it.
  • Non-Data variants continue to use the outer as_short_name(), so diagnostics for ServerDeactivateAll and ClientConfirmActive are preserved verbatim.

Validation

  • Three unit tests in legacy::tests cover the helper: a non-Data variant (ServerDeactivateAll), a Data wrapper around a non-SetErrorInfo inner (Update(Vec::new())), and a Data wrapper around ServerSetErrorInfo carrying ProtocolIndependentCode::ServerDeniedConnection.
  • cargo xtask ci clean locally on 1.89.0: fmt, lints, tests, typos, locks all green.

Notes

  • Helper is pub(crate); no public API surface change.
  • Ask 2 from Surface the actual Share Control PDU type when 'unexpected Share Control Pdu' fires #1232 (an optional structured ConnectorErrorKind variant for "server rejected at capabilities phase") is intentionally deferred. The asker framed it as optional and the wire-level information is now available in the Reason string.
  • Refs #1232 rather than Closes so the issue stays open while you decide on ask 2.

When the server sends a ShareControlPdu::Data wrapping a ShareDataPdu
the client did not expect, the three error sites in legacy.rs and
connection_activation.rs previously reported only "Data" via the outer
ShareControlPdu::as_short_name(). For the common case where the
server rejects a session by sending ServerSetErrorInfo, this hid the
information the client actually needed to diagnose the failure.

A new pub(crate) helper describe_unexpected_share_control_pdu drills
into the Data wrapper and surfaces the inner ShareDataPdu variant
name. When the inner variant is ServerSetErrorInfo, the ErrorInfo
description is appended so callers can see why the server rejected
the session without substring matching on the Reason string.

The three sites in decode_share_data, decode_io_channel, and the
ConnectionActivation::CapabilitiesExchange handler route through the
helper. Non-Data variants continue to use the outer as_short_name(),
so diagnostics for ServerDeactivateAll and ClientConfirmActive are
preserved verbatim.

Three unit tests cover the helper: a non-Data variant, a Data wrapper
around a non-SetErrorInfo inner, and a Data wrapper around
ServerSetErrorInfo carrying a ProtocolIndependentCode error.

Refs Devolutions#1232.
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.

1 participant