Skip to content

Commit 4a11893

Browse files
authored
fix(agent): add stub RDM sync message implementation (#1608)
Devolutions Session currently implements now-proto 1.4, which requires RDM sync messages handling; This patch adds stub message implementation (only sends timestamp), which is needed to correctly handle all RDM protocol messages until future work is completed. Issue: PI-651 Changelog: ignore
1 parent 1fc3436 commit 4a11893

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

devolutions-session/src/dvc/task.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::collections::HashMap;
2+
use std::time::{SystemTime, UNIX_EPOCH};
23

34
use anyhow::{Context, bail};
45
use async_trait::async_trait;
@@ -26,9 +27,9 @@ use now_proto_pdu::{
2627
ComApartmentStateKind, NowChannelCapsetMsg, NowChannelCloseMsg, NowChannelHeartbeatMsg, NowChannelMessage,
2728
NowExecBatchMsg, NowExecCancelRspMsg, NowExecCapsetFlags, NowExecDataMsg, NowExecDataStreamKind, NowExecMessage,
2829
NowExecProcessMsg, NowExecPwshMsg, NowExecResultMsg, NowExecRunMsg, NowExecStartedMsg, NowExecWinPsMsg, NowMessage,
29-
NowMsgBoxResponse, NowProtoError, NowProtoVersion, NowSessionCapsetFlags, NowSessionMessage,
30-
NowSessionMsgBoxReqMsg, NowSessionMsgBoxRspMsg, NowStatusError, NowSystemCapsetFlags, NowSystemMessage,
31-
SetKbdLayoutOption,
30+
NowMsgBoxResponse, NowProtoError, NowProtoVersion, NowRdmCapabilitiesMsg, NowRdmMessage, NowSessionCapsetFlags,
31+
NowSessionMessage, NowSessionMsgBoxReqMsg, NowSessionMsgBoxRspMsg, NowStatusError, NowSystemCapsetFlags,
32+
NowSystemMessage, SetKbdLayoutOption,
3233
};
3334
use win_api_wrappers::event::Event;
3435
use win_api_wrappers::security::privilege::ScopedPrivileges;
@@ -331,6 +332,20 @@ impl MessageProcessor {
331332
message: NowMessage<'static>,
332333
) -> anyhow::Result<ProcessMessageAction> {
333334
match message {
335+
NowMessage::Rdm(NowRdmMessage::Capabilities(_)) => {
336+
// Send empty capabilities (as RDM app is not available on the server side).
337+
338+
let server_timestamp = SystemTime::now()
339+
.duration_since(UNIX_EPOCH)
340+
.context("Failed to get current timestamp")?
341+
.as_secs();
342+
343+
let rdm_caps = NowRdmCapabilitiesMsg::new(server_timestamp, String::new())?;
344+
345+
self.dvc_tx
346+
.send(NowMessage::Rdm(NowRdmMessage::Capabilities(rdm_caps)))
347+
.await?;
348+
}
334349
NowMessage::Channel(NowChannelMessage::Capset(client_caps)) => {
335350
return Ok(ProcessMessageAction::Restart(client_caps));
336351
}

0 commit comments

Comments
 (0)