From fc556e45fa1be9b7f7d441fbfd12d33b3e116d3f Mon Sep 17 00:00:00 2001 From: ldm0 Date: Mon, 23 Nov 2026 15:26:04 +0800 Subject: [PATCH] fix(protocol): adapt CDP pipes to Tokio 1.53.3 --- Cargo.lock | 4 ++-- moli-protocol-server/Cargo.toml | 4 ++-- moli-protocol-server/src/protocol_server/cdp_pipe.rs | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d86f3f83053..066ba8ee2ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6131,9 +6131,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.53.1" +version = "1.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +checksum = "ce3335fa71841cda333a58d7615b03901380ecf09d59b3296d21f8bbac0dde4e" dependencies = [ "bytes", "libc", diff --git a/moli-protocol-server/Cargo.toml b/moli-protocol-server/Cargo.toml index 83f1f505cbe..1735288a9f6 100644 --- a/moli-protocol-server/Cargo.toml +++ b/moli-protocol-server/Cargo.toml @@ -31,7 +31,7 @@ rand = "0.10.3" serde_json = "1.0.145" socket2 = { version = "0.6.3", features = ["all"] } thiserror = "2.0.17" -tokio = { version = "1.51.0", features = ["io-std", "io-util", "macros", "net", "rt-multi-thread", "signal", "sync"] } +tokio = { version = "1.53.3", features = ["io-std", "io-util", "macros", "net", "rt-multi-thread", "signal", "sync"] } tracing = "0.1.41" tower = { version = "0.5.2", default-features = false, features = ["util"] } url = "2.5.7" @@ -43,7 +43,7 @@ moli-protocol = { path = "../moli-protocol", features = ["test-support"] } moli-test-support = { path = "../moli-test-support" } png = "0.18" time = "0.3" -tokio = { version = "1.51.0", features = ["test-util"] } +tokio = { version = "1.53.3", features = ["test-util"] } tokio-tungstenite = "0.28.0" [lints] diff --git a/moli-protocol-server/src/protocol_server/cdp_pipe.rs b/moli-protocol-server/src/protocol_server/cdp_pipe.rs index 84c8412afac..7cceff0f1a6 100644 --- a/moli-protocol-server/src/protocol_server/cdp_pipe.rs +++ b/moli-protocol-server/src/protocol_server/cdp_pipe.rs @@ -25,7 +25,9 @@ struct PipeFd(tokio::io::unix::AsyncFd); impl PipeFd { fn new(file: std::fs::File) -> io::Result { socket2::SockRef::from(&file).set_nonblocking(true)?; - Ok(Self(tokio::io::unix::AsyncFd::new(file)?)) + // SAFETY: AsyncFd owns the File and its descriptor until deregistration. + let fd = unsafe { tokio::io::unix::AsyncFd::register(file)? }; + Ok(Self(fd)) } }