aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.bleep2
-rw-r--r--pingora-core/src/listeners/mod.rs1
-rw-r--r--pingora-core/src/protocols/digest.rs1
-rw-r--r--pingora-core/src/protocols/l4/ext.rs24
-rw-r--r--pingora-core/src/protocols/l4/socket.rs1
-rw-r--r--pingora-core/src/protocols/l4/stream.rs2
-rw-r--r--pingora-core/src/server/mod.rs1
7 files changed, 24 insertions, 8 deletions
diff --git a/.bleep b/.bleep
index eccaf86..26298b0 100644
--- a/.bleep
+++ b/.bleep
@@ -1 +1 @@
-0c3b05818a9e9be92d0861b1e72254dadcd978c5 \ No newline at end of file
+78684dca2f7fe5d952d3b01faec526a1b1cbad8c \ No newline at end of file
diff --git a/pingora-core/src/listeners/mod.rs b/pingora-core/src/listeners/mod.rs
index 02a7b83..0c5d78e 100644
--- a/pingora-core/src/listeners/mod.rs
+++ b/pingora-core/src/listeners/mod.rs
@@ -71,6 +71,7 @@ pub(crate) struct TransportStack {
l4: ListenerEndpoint,
tls: Option<Arc<Acceptor>>,
// listeners sent from the old process for graceful upgrade
+ #[cfg(unix)]
upgrade_listeners: Option<ListenFds>,
}
diff --git a/pingora-core/src/protocols/digest.rs b/pingora-core/src/protocols/digest.rs
index 19dc78d..046b4a1 100644
--- a/pingora-core/src/protocols/digest.rs
+++ b/pingora-core/src/protocols/digest.rs
@@ -91,6 +91,7 @@ impl SocketDigest {
raw_sock,
peer_addr: OnceCell::new(),
local_addr: OnceCell::new(),
+ original_dst: OnceCell::new(),
}
}
diff --git a/pingora-core/src/protocols/l4/ext.rs b/pingora-core/src/protocols/l4/ext.rs
index b687cc4..706fc7b 100644
--- a/pingora-core/src/protocols/l4/ext.rs
+++ b/pingora-core/src/protocols/l4/ext.rs
@@ -203,11 +203,16 @@ fn ip_local_port_range(fd: RawFd, low: u16, high: u16) -> io::Result<()> {
}
}
-#[cfg(not(target_os = "linux"))]
+#[cfg(all(unix, not(target_os = "linux")))]
fn ip_local_port_range(_fd: RawFd, _low: u16, _high: u16) -> io::Result<()> {
Ok(())
}
+#[cfg(windows)]
+fn ip_local_port_range(_fd: RawSocket, _low: u16, _high: u16) -> io::Result<()> {
+ Ok(())
+}
+
#[cfg(target_os = "linux")]
fn set_so_keepalive(fd: RawFd, val: bool) -> io::Result<()> {
set_opt(fd, libc::SOL_SOCKET, libc::SO_KEEPALIVE, val as c_int)
@@ -262,11 +267,16 @@ pub fn get_tcp_info(fd: RawFd) -> io::Result<TCP_INFO> {
get_opt_sized(fd, libc::IPPROTO_TCP, libc::TCP_INFO)
}
-#[cfg(not(target_os = "linux"))]
+#[cfg(all(unix, not(target_os = "linux")))]
pub fn get_tcp_info(_fd: RawFd) -> io::Result<TCP_INFO> {
Ok(unsafe { TCP_INFO::new() })
}
+#[cfg(windows)]
+pub fn get_tcp_info(_fd: RawSocket) -> io::Result<TCP_INFO> {
+ Ok(unsafe { TCP_INFO::new() })
+}
+
/// Set the TCP receive buffer size. See SO_RCVBUF.
#[cfg(target_os = "linux")]
pub fn set_recv_buf(fd: RawFd, val: usize) -> Result<()> {
@@ -490,10 +500,12 @@ async fn inner_connect_with<F: FnOnce(&TcpSocket) -> Result<()>>(
}
#[cfg(windows)]
- if let Some(baddr) = bind_to {
- socket
- .bind(*baddr)
- .or_err_with(BindError, || format!("failed to bind to socket {}", *baddr))?;
+ if let Some(bind_to) = bind_to {
+ if let Some(baddr) = bind_to.addr {
+ socket
+ .bind(baddr)
+ .or_err_with(BindError, || format!("failed to bind to socket {}", baddr))?;
+ };
};
// TODO: add support for bind on other platforms
diff --git a/pingora-core/src/protocols/l4/socket.rs b/pingora-core/src/protocols/l4/socket.rs
index 64e0e07..c8413d8 100644
--- a/pingora-core/src/protocols/l4/socket.rs
+++ b/pingora-core/src/protocols/l4/socket.rs
@@ -246,7 +246,6 @@ impl std::net::ToSocketAddrs for SocketAddr {
}
}
-#[cfg(unix)]
impl From<StdSockAddr> for SocketAddr {
fn from(sockaddr: StdSockAddr) -> Self {
SocketAddr::Inet(sockaddr)
diff --git a/pingora-core/src/protocols/l4/stream.rs b/pingora-core/src/protocols/l4/stream.rs
index 8ecb515..e561908 100644
--- a/pingora-core/src/protocols/l4/stream.rs
+++ b/pingora-core/src/protocols/l4/stream.rs
@@ -296,6 +296,7 @@ impl AsyncWrite for RawStreamWrapper {
unsafe {
match &mut Pin::get_unchecked_mut(self).stream {
RawStream::Tcp(s) => Pin::new_unchecked(s).poll_shutdown(cx),
+ #[cfg(unix)]
RawStream::Unix(s) => Pin::new_unchecked(s).poll_shutdown(cx),
}
}
@@ -310,6 +311,7 @@ impl AsyncWrite for RawStreamWrapper {
unsafe {
match &mut Pin::get_unchecked_mut(self).stream {
RawStream::Tcp(s) => Pin::new_unchecked(s).poll_write_vectored(cx, bufs),
+ #[cfg(unix)]
RawStream::Unix(s) => Pin::new_unchecked(s).poll_write_vectored(cx, bufs),
}
}
diff --git a/pingora-core/src/server/mod.rs b/pingora-core/src/server/mod.rs
index c86c49e..9762dc8 100644
--- a/pingora-core/src/server/mod.rs
+++ b/pingora-core/src/server/mod.rs
@@ -246,6 +246,7 @@ impl Server {
Ok(Server {
services: vec![],
+ #[cfg(unix)]
listen_fds: None,
shutdown_watch: tx,
shutdown_recv: rx,