Skip to content

Commit

Permalink
Fix non linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhavck authored and johnhurt committed Apr 26, 2024
1 parent 218dbdf commit 2501d4a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .bleep
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ffd2f7edb1d520d04fe3ec61dab949b10ff6e0f1
0d6c0fbd55a4b0d8b5f2ae892a6602457dc61b7e
26 changes: 13 additions & 13 deletions pingora-core/src/protocols/l4/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub fn set_recv_buf(fd: RawFd, val: usize) -> Result<()> {
}

#[cfg(not(target_os = "linux"))]
pub fn set_recv_buf(_fd: RawFd) -> io::Result<()> {
pub fn set_recv_buf(_fd: RawFd, _: usize) -> Result<()> {
Ok(())
}

Expand Down Expand Up @@ -318,18 +318,18 @@ mod test {
let socket = TcpSocket::new_v4().unwrap();
set_recv_buf(socket.as_raw_fd(), 102400).unwrap();

let mut recv_size: c_int = 0;
let mut size = std::mem::size_of::<c_int>() as u32;
get_opt(
socket.as_raw_fd(),
libc::SOL_SOCKET,
libc::SO_RCVBUF,
&mut recv_size,
&mut size,
)
.unwrap();

if cfg!(target_os = "linux") {
#[cfg(target_os = "linux")]
{
let mut recv_size: c_int = 0;
let mut size = std::mem::size_of::<c_int>() as u32;
get_opt(
socket.as_raw_fd(),
libc::SOL_SOCKET,
libc::SO_RCVBUF,
&mut recv_size,
&mut size,
)
.unwrap();
// kernel doubles whatever is set
assert_eq!(recv_size, 102400 * 2);
}
Expand Down

0 comments on commit 2501d4a

Please sign in to comment.