Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/srv/desktop/rdp/rdpclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,19 @@ func (c *Client) startInputStreaming(stopCh chan struct{}) error {
continue
}

c.UpdateClientActivity()
// If the message was due to user input, then we update client activity
// in order to refresh the client_idle_timeout checks.
//
// Note: we count some of the directory sharing messages as client activity
// because we don't want a session to be closed due to inactivity during a large
// file transfer.
switch msg.(type) {
case tdp.KeyboardButton, tdp.MouseMove, tdp.MouseButton, tdp.MouseWheel,
tdp.SharedDirectoryAnnounce, tdp.SharedDirectoryInfoResponse,
tdp.SharedDirectoryReadResponse, tdp.SharedDirectoryWriteResponse:

c.UpdateClientActivity()
}

if withheldResize != nil {
c.cfg.Logger.DebugContext(context.Background(), "Sending withheld screen size to client")
Expand Down
14 changes: 7 additions & 7 deletions web/packages/shared/libs/tdp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export class TdpClient extends EventEmitter<EventMap> {
this.handleRdpConnectionActivated(buffer);
break;
case MessageType.RDP_FASTPATH_PDU:
this.handleRdpFastPathPDU(buffer);
this.handleRdpFastPathPdu(buffer);
break;
case MessageType.CLIENT_SCREEN_SPEC:
this.handleClientScreenSpec(buffer);
Expand Down Expand Up @@ -448,22 +448,22 @@ export class TdpClient extends EventEmitter<EventMap> {
this.emit(TdpClientEvent.TDP_CLIENT_SCREEN_SPEC, spec);
}

handleRdpFastPathPDU(buffer: ArrayBuffer) {
let rdpFastPathPDU = this.codec.decodeRdpFastPathPDU(buffer);
handleRdpFastPathPdu(buffer: ArrayBufferLike) {
let rdpFastPathPdu = this.codec.decodeRdpFastPathPdu(buffer);

// This should never happen but let's catch it with an error in case it does.
if (!this.fastPathProcessor) {
throw new Error('FastPathProcessor not initialized');
}

this.fastPathProcessor.process(
rdpFastPathPDU,
rdpFastPathPdu,
this,
(bmpFrame: BitmapFrame) => {
this.emit(TdpClientEvent.TDP_BMP_FRAME, bmpFrame);
},
(responseFrame: ArrayBuffer) => {
this.sendRdpResponsePDU(responseFrame);
this.sendRdpResponsePdu(responseFrame);
},
(data: ImageData | boolean, hotspot_x?: number, hotspot_y?: number) => {
this.emit(TdpClientEvent.POINTER, { data, hotspot_x, hotspot_y });
Expand Down Expand Up @@ -770,8 +770,8 @@ export class TdpClient extends EventEmitter<EventMap> {
this.sendClientScreenSpec(spec);
};

sendRdpResponsePDU(responseFrame: ArrayBuffer) {
this.send(this.codec.encodeRdpResponsePDU(responseFrame));
sendRdpResponsePdu(responseFrame: ArrayBufferLike) {
this.send(this.codec.encodeRdpResponsePdu(responseFrame));
}

// Emits a warning event, but keeps the socket open.
Expand Down
4 changes: 2 additions & 2 deletions web/packages/shared/libs/tdp/codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ export default class Codec {
}

// | message type (30) | data_length uint32 | data []byte |
encodeRdpResponsePDU(responseFrame: ArrayBuffer): Message {
encodeRdpResponsePdu(responseFrame: ArrayBufferLike): Message {
const bufLen = BYTE_LEN + UINT_32_LEN + responseFrame.byteLength;
const buffer = new ArrayBuffer(bufLen);
const view = new DataView(buffer);
Expand Down Expand Up @@ -871,7 +871,7 @@ export default class Codec {
}

// | message type (29) | data_length uint32 | data []byte |
decodeRdpFastPathPDU(buffer: ArrayBuffer): RdpFastPathPdu {
decodeRdpFastPathPdu(buffer: ArrayBufferLike): RdpFastPathPdu {
const dv = new DataView(buffer);
let offset = 0;
offset += BYTE_LEN; // eat message type
Expand Down
2 changes: 1 addition & 1 deletion web/packages/teleport/src/lib/tdp/playerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export class PlayerClient extends TdpClient {
// RDP response PDUs to the server during playback, which is unnecessary
// and breaks the playback system.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
sendRdpResponsePDU(responseFrame: ArrayBuffer) {
sendRdpResponsePdu(responseFrame: ArrayBuffer) {
return;
}

Expand Down
Loading