Skip to content

Commit 08f744d

Browse files
committed
refactor(server): use ServerResultExt::with_context at two server.rs sites
Replaces the closure-based set_context pattern at the UpdateEncoder::new and client_loop call sites in run_connection with the ServerResultExt::with_context ext-trait. Same semantics (preserves the inner kind, replaces the context string), substantially less verbose. Precheck-driven cleanup; no behavioral change.
1 parent 6bd3833 commit 08f744d

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

crates/ironrdp-server/src/server.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use crate::clipboard::CliprdrServerFactory;
3434
use crate::display::{DisplayUpdate, RdpServerDisplay};
3535
use crate::echo::{EchoDvcBridge, EchoServerHandle, EchoServerMessage, build_echo_request};
3636
use crate::encoder::{UpdateEncoder, UpdateEncoderCodecs};
37-
use crate::error::{ServerError, ServerErrorExt as _, ServerResult, from_anyhow};
37+
use crate::error::{ServerError, ServerErrorExt as _, ServerResult, ServerResultExt as _, from_anyhow};
3838
#[cfg(feature = "egfx")]
3939
use crate::gfx::{EgfxServerMessage, GfxServerFactory};
4040
use crate::handler::RdpServerInputHandler;
@@ -1094,20 +1094,12 @@ impl RdpServer {
10941094

10951095
let desktop_size = self.display.lock().await.size().await;
10961096
let encoder = UpdateEncoder::new(desktop_size, surface_flags, update_codecs, self.opts.max_request_size)
1097-
.map_err(|e| {
1098-
let mut e = e;
1099-
e.set_context("failed to initialize update encoder");
1100-
e
1101-
})?;
1097+
.with_context("failed to initialize update encoder")?;
11021098

11031099
let state = self
11041100
.client_loop(reader, writer, result.io_channel_id, result.user_channel_id, encoder)
11051101
.await
1106-
.map_err(|e| {
1107-
let mut e = e;
1108-
e.set_context("client loop failure");
1109-
e
1110-
})?;
1102+
.with_context("client loop failure")?;
11111103

11121104
Ok(state)
11131105
}

0 commit comments

Comments
 (0)