mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-08 05:20:59 +03:00
port forward: fix round 1 review findings
Drop the mux default-false assignment now that definite-assignment proves every path that reads it has set it; the enable-port-forward-mux config commit picks up the missing attribution trailers; the default-on test pins the enable- prefix itself rather than option2bool's weaker fallback. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZ49AbZJYfm8NTp5yDPMab
This commit is contained in:
Submodule libs/hbb_common updated: 26da70418c...1e617ddf4d
@@ -265,7 +265,7 @@ async fn connect_and_login(
|
||||
}
|
||||
let mut buffer = Vec::new();
|
||||
let mut local_eof = false;
|
||||
let mut mux = false;
|
||||
let mux;
|
||||
let mut received = false;
|
||||
let mut challenge = None;
|
||||
let mut pending_login = None;
|
||||
@@ -461,8 +461,11 @@ mod tests {
|
||||
#[test]
|
||||
fn port_forward_mux_defaults_to_on() {
|
||||
use hbb_common::config::{keys, option2bool};
|
||||
// The `enable-` prefix is what makes an unset value mean on. Getting the
|
||||
// key's name wrong silently flips the default, so pin it here.
|
||||
// option2bool's fallback branch is also "on unless N", so the value
|
||||
// assertions below would pass for a prefixless key too. The `enable-`
|
||||
// prefix is what actually guarantees the default, and renaming the key
|
||||
// to an `allow-` one would silently flip it — pin the prefix itself.
|
||||
assert!(keys::OPTION_ENABLE_PORT_FORWARD_MUX.starts_with("enable-"));
|
||||
assert!(option2bool(keys::OPTION_ENABLE_PORT_FORWARD_MUX, ""));
|
||||
assert!(option2bool(keys::OPTION_ENABLE_PORT_FORWARD_MUX, "Y"));
|
||||
assert!(!option2bool(keys::OPTION_ENABLE_PORT_FORWARD_MUX, "N"));
|
||||
|
||||
Reference in New Issue
Block a user