Skip to content

Commit 0f9877a

Browse files
elmarcoCBenoit
authored andcommitted
fix(server): check client size
It's problematic when the client didn't resize, as we send bitmap updates that don't fit. The client will likely drop the connection. Let's have a warning for this case in the server. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
1 parent e21c556 commit 0f9877a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

crates/ironrdp-server/src/server.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,28 @@ impl RdpServer {
679679
bail!("Fastpath output not supported!");
680680
}
681681
}
682+
CapabilitySet::Bitmap(b) => {
683+
if !b.desktop_resize_flag {
684+
debug!("Desktop resize is not supported by the client");
685+
continue;
686+
}
687+
688+
let client_size = DesktopSize {
689+
width: b.desktop_width,
690+
height: b.desktop_height,
691+
};
692+
let display_size = self.display.lock().await.size().await;
693+
694+
// It's problematic when the client didn't resize, as we send bitmap updates that don't fit.
695+
// The client will likely drop the connection.
696+
if client_size.width < display_size.width || client_size.height < display_size.height {
697+
// TODO: we may have different behaviour instead, such as clipping or scaling?
698+
warn!(
699+
"Client size doesn't fit the server size: {:?} < {:?}",
700+
client_size, display_size
701+
);
702+
}
703+
}
682704
CapabilitySet::SurfaceCommands(c) => {
683705
surface_flags = c.flags;
684706
}

0 commit comments

Comments
 (0)