aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrew Hauck <[email protected]>2024-09-27 11:40:03 -0700
committerYuchen Wu <[email protected]>2024-10-11 15:40:59 -0700
commitaf565b4e24f1b8e4d7f1b7224d62b8029c580496 (patch)
tree880cf1168164bf7ce310524da43b58cd78e06c8b
parent232614246229ff23f483e666abc43b93178534a0 (diff)
downloadpingora-af565b4e24f1b8e4d7f1b7224d62b8029c580496.tar.gz
pingora-af565b4e24f1b8e4d7f1b7224d62b8029c580496.zip
Fix all the warnings for non-linux unix
-rw-r--r--.bleep2
-rw-r--r--pingora-core/src/protocols/l4/ext.rs2
-rw-r--r--pingora-core/src/protocols/l4/stream.rs9
3 files changed, 10 insertions, 3 deletions
diff --git a/.bleep b/.bleep
index 5859e11..a931ea7 100644
--- a/.bleep
+++ b/.bleep
@@ -1 +1 @@
-e2493b0330def4631d98161f1f0a477b440f3a85 \ No newline at end of file
+089f8397486e934dbbe045085ba3648e0bb945a5 \ No newline at end of file
diff --git a/pingora-core/src/protocols/l4/ext.rs b/pingora-core/src/protocols/l4/ext.rs
index d3ab70d..5437198 100644
--- a/pingora-core/src/protocols/l4/ext.rs
+++ b/pingora-core/src/protocols/l4/ext.rs
@@ -423,7 +423,7 @@ async fn inner_connect_with<F: FnOnce(&TcpSocket) -> Result<()>>(
}
.or_err(SocketError, "failed to create socket")?;
- #[cfg(target_os = "linux")]
+ #[cfg(unix)]
{
ip_bind_addr_no_port(socket.as_raw_fd(), true).or_err(
SocketError,
diff --git a/pingora-core/src/protocols/l4/stream.rs b/pingora-core/src/protocols/l4/stream.rs
index 898b3e6..30b05a0 100644
--- a/pingora-core/src/protocols/l4/stream.rs
+++ b/pingora-core/src/protocols/l4/stream.rs
@@ -19,6 +19,7 @@ use futures::FutureExt;
use log::{debug, error};
use pingora_error::{ErrorType::*, OrErr, Result};
+#[cfg(target_os = "linux")]
use std::io::IoSliceMut;
#[cfg(unix)]
use std::os::unix::io::AsRawFd;
@@ -28,7 +29,9 @@ use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
use std::time::{Duration, Instant, SystemTime};
-use tokio::io::{self, AsyncRead, AsyncWrite, AsyncWriteExt, BufStream, Interest, ReadBuf};
+#[cfg(target_os = "linux")]
+use tokio::io::Interest;
+use tokio::io::{self, AsyncRead, AsyncWrite, AsyncWriteExt, BufStream, ReadBuf};
use tokio::net::TcpStream;
#[cfg(unix)]
use tokio::net::UnixStream;
@@ -148,6 +151,7 @@ struct RawStreamWrapper {
/// store the last rx timestamp of the stream.
pub(crate) rx_ts: Option<SystemTime>,
/// enable reading rx timestamp
+ #[cfg(target_os = "linux")]
pub(crate) enable_rx_ts: bool,
#[cfg(target_os = "linux")]
/// This can be reused across multiple recvmsg calls. The cmsg buffer may
@@ -161,12 +165,14 @@ impl RawStreamWrapper {
RawStreamWrapper {
stream,
rx_ts: None,
+ #[cfg(target_os = "linux")]
enable_rx_ts: false,
#[cfg(target_os = "linux")]
reusable_cmsg_space: nix::cmsg_space!(nix::sys::time::TimeSpec),
}
}
+ #[cfg(target_os = "linux")]
pub fn enable_rx_ts(&mut self, enable_rx_ts: bool) {
self.enable_rx_ts = enable_rx_ts;
}
@@ -791,6 +797,7 @@ impl AccumulatedDuration {
}
#[cfg(test)]
+#[cfg(target_os = "linux")]
mod tests {
use super::*;
use std::sync::Arc;