Skip to content

Commit

Permalink
Auto merge of #25 - antrik:fix-large-transfers, r=pcwalton
Browse files Browse the repository at this point in the history
Linux: Fix corruption of big transfers on 32 bit systems

The wrong size calculation magically worked on 64 bit systems, because
2 * sizeof u32 is the same as sizeof usize there -- but not on 32 bit
systems, where this dropped 4 bytes of each full fragment.

With this, Servo works again for me. (And we are down to 4 failing ipc-channel tests on my system...)
  • Loading branch information
bors-servo committed Jan 13, 2016
2 parents 7272e55 + 8808491 commit cb08050
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion platform/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl UnixSender {
&mut maximum_send_size_len as *mut socklen_t) < 0 {
return Err(UnixError::last())
}
let bytes_per_fragment = maximum_send_size - (mem::size_of::<usize>() +
let bytes_per_fragment = maximum_send_size - (mem::size_of::<u32>() * 2 +
CMSG_SPACE(cmsg_length as size_t) as usize + 256);

// Split up the packet into fragments.
Expand Down

0 comments on commit cb08050

Please sign in to comment.