You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it doesn't work because message length is sent as a usize, which is 8 bytes in 64-bit processes and 4 bytes in 32-bit processes. This workaround seems to make it work for my specific case (limiting the total message length to the 32-bit process limit):
diff --git a/src/platform/unix/mod.rs b/src/platform/unix/mod.rs
index 41953ca..1384f2f 100644
--- a/src/platform/unix/mod.rs+++ b/src/platform/unix/mod.rs@@ -259,6 +259,8 @@ impl OsIpcSender {
// which in a fragmented send will be smaller than the total message length.
fn send_first_fragment(sender_fd: c_int, fds: &[c_int], data_buffer: &[u8], len: usize)
-> Result<(),UnixError> {
+ let len: u32 = len.try_into().unwrap();+
let result = unsafe {
let cmsg_length = mem::size_of_val(fds);
let (cmsg_buffer, cmsg_space) = if cmsg_length > 0 {
@@ -913,7 +915,7 @@ fn recv(fd: c_int, blocking_mode: BlockingMode)
//
// We use this to determine whether we already got the entire message,
// or need to receive additional fragments -- and if so, how much.
- let mut total_size = 0usize;+ let mut total_size = 0u32;
let mut main_data_buffer;
unsafe {
// Allocate a buffer without initialising the memory.
@@ -952,6 +954,8 @@ fn recv(fd: c_int, blocking_mode: BlockingMode)
}
}
+ let total_size: usize = total_size.try_into().unwrap();+
if total_size == main_data_buffer.len() {
// Fast path: no fragments.
return Ok((main_data_buffer, channels, shared_memory_regions))
The text was updated successfully, but these errors were encountered:
Currently it doesn't work because message length is sent as a
usize
, which is 8 bytes in 64-bit processes and 4 bytes in 32-bit processes. This workaround seems to make it work for my specific case (limiting the total message length to the 32-bit process limit):The text was updated successfully, but these errors were encountered: