Skip to content

Commit 6d09d8a

Browse files
authored
Update windows to 0.62 and rand to 0.10 (#455)
* Update windows to 0.62 Signed-off-by: Sam <16504129+sagudev@users.noreply.github.com> * fixup Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * clippy fixes Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * bump more Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * update rand to 0.10 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * f Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: Sam <16504129+sagudev@users.noreply.github.com> Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
1 parent 48ad1a8 commit 6d09d8a

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ipc-channel"
3-
version = "0.22.0"
3+
version = "0.23.0"
44
description = "A multiprocess drop-in replacement for Rust channels"
55
authors = ["The Servo Project Developers"]
66
license = "MIT OR Apache-2.0"
@@ -42,7 +42,7 @@ crossbeam-channel = "0.5"
4242
futures-channel = { version = "0.3.32", optional = true }
4343
futures-core = { version = "0.3.32", optional = true }
4444
libc = "0.2.162"
45-
postcard = {version = "1.1", default-features = false, features = ["use-std"]}
45+
postcard = { version = "1.1", default-features = false, features = ["use-std"] }
4646
serde_core = "1.0"
4747
thiserror = "2.0.12"
4848
uuid = { version = "1", features = ["v4"] }
@@ -53,18 +53,18 @@ rustc-hash = "2.1"
5353
tempfile = "3.4"
5454

5555
[target.'cfg(target_os = "macos")'.dependencies]
56-
rand = "0.9"
56+
rand = "0.10"
5757

5858
[dev-dependencies]
5959
serde = { version = "1.0", features = ["rc"] }
6060
crossbeam-utils = "0.8"
6161
futures-test = "0.3"
6262
static_assertions = "1.1.0"
6363
criterion = { version = "0.5", features = ["html_reports"] }
64-
rand = "0.9.2"
64+
rand = "0.10"
6565

6666
[target.'cfg(target_os = "windows")'.dependencies.windows]
67-
version = "0.61"
67+
version = "0.62"
6868
features = [
6969
"Win32_Foundation",
7070
"Win32_System_WindowsProgramming",

src/platform/macos/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use self::mach_sys::{mach_port_right_t, mach_port_t, mach_task_self_, vm_inherit
1515
use crate::ipc::IpcMessage;
1616

1717
use libc::{self, c_char, c_uint, c_void, size_t};
18-
use rand::{self, Rng};
18+
use rand::{self, RngExt};
1919
use std::cell::Cell;
2020
use std::convert::TryInto;
2121
use std::ffi::CString;

src/platform/windows/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ fn write_buf(handle: &WinHandle, bytes: &[u8], atomic: AtomicMode) -> Result<(),
11141114
sz,
11151115
written,
11161116
total,
1117-
WinError::from_win32()
1117+
WinError::from_thread()
11181118
);
11191119
},
11201120
}
@@ -1482,21 +1482,21 @@ impl OsIpcSender {
14821482
full_message.extend_from_slice(header_bytes);
14831483
}
14841484

1485-
if big_data_sender.is_none() {
1486-
full_message.extend_from_slice(data);
1485+
if let Some(big_data_sender) = big_data_sender {
14871486
full_message.extend_from_slice(&oob_data);
14881487
assert!(full_message.len() == full_in_band_len);
14891488

1490-
// Write needs to be atomic, since otherwise concurrent sending
1491-
// could result in parts of different messages getting intermixed,
1492-
// and the receiver would not be able to extract the individual messages.
14931489
write_buf(&self.handle, &full_message, AtomicMode::Atomic)?;
1490+
big_data_sender.send_raw(data)?;
14941491
} else {
1492+
full_message.extend_from_slice(data);
14951493
full_message.extend_from_slice(&oob_data);
14961494
assert!(full_message.len() == full_in_band_len);
14971495

1496+
// Write needs to be atomic, since otherwise concurrent sending
1497+
// could result in parts of different messages getting intermixed,
1498+
// and the receiver would not be able to extract the individual messages.
14981499
write_buf(&self.handle, &full_message, AtomicMode::Atomic)?;
1499-
big_data_sender.unwrap().send_raw(data)?;
15001500
}
15011501

15021502
Ok(())
@@ -2022,7 +2022,7 @@ impl OsIpcSharedMemory {
20222022
unsafe {
20232023
let address = MapViewOfFile(handle.as_raw(), FILE_MAP_ALL_ACCESS, 0, 0, 0);
20242024
if address.Value.is_null() {
2025-
return Err(WinError::from_win32());
2025+
return Err(WinError::from_thread());
20262026
}
20272027

20282028
Ok(OsIpcSharedMemory {

src/platform/windows/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use windows::Win32::Foundation::{
55
CloseHandle, CompareObjectHandles, ERROR_INVALID_HANDLE, HANDLE, INVALID_HANDLE_VALUE,
66
};
77
use windows::Win32::System::Memory::{CreateFileMappingA, PAGE_READWRITE};
8-
use windows::Win32::System::Threading::{CreateEventA, GetCurrentProcessId};
8+
use windows::Win32::System::Threading::CreateEventA;
99

1010
#[test]
1111
fn test_recover_handles_empty() {
@@ -38,7 +38,7 @@ fn test_recover_handles_duplicates_channel_handles() {
3838
assert_eq!(oob.channel_handles.len(), 3);
3939
for (i, handle) in oob.channel_handles.iter().enumerate() {
4040
assert_ne!(*handle, handles[i]);
41-
assert_ne!(*handle as isize, INVALID_HANDLE_VALUE.0 as isize);
41+
assert_ne!(*handle, INVALID_HANDLE_VALUE.0 as isize);
4242
}
4343

4444
// Clean up the handles
@@ -90,7 +90,7 @@ fn test_recover_handles_duplicates_shmem_handles() {
9090
let mut oob = OutOfBandMessage {
9191
target_process_id: std::process::id(),
9292
channel_handles: vec![],
93-
shmem_handles: handles.clone().into_iter().zip(sizes.into_iter()).collect(),
93+
shmem_handles: handles.clone().into_iter().zip(sizes).collect(),
9494
big_data_receiver_handle: None,
9595
};
9696

0 commit comments

Comments
 (0)