From 6da94f92a0f2f86f97cd015262c88bcce61093b7 Mon Sep 17 00:00:00 2001 From: soddy Date: Mon, 9 Feb 2026 15:42:41 +0800 Subject: [PATCH] fix(windows): add missing `RawStream::Virtual` match arm in `AsRawSocket` impl The `#[cfg(windows)] impl AsRawSocket for RawStream` was missing a match arm for the `RawStream::Virtual(_)` variant, causing a compilation error (E0004: non-exhaustive patterns) on Windows targets. The `Virtual` variant is not gated by any `#[cfg]` attribute and exists on all platforms, but the Windows `AsRawSocket` implementation only matched `RawStream::Tcp(s)`. This fix adds the missing arm, returning `!0` (INVALID_SOCKET) for virtual streams, consistent with the Unix `AsRawFd` implementation which returns `-1` for the same variant. Co-authored-by: Cursor --- pingora-core/src/protocols/l4/stream.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pingora-core/src/protocols/l4/stream.rs b/pingora-core/src/protocols/l4/stream.rs index 59ec3f60..4aa70f70 100644 --- a/pingora-core/src/protocols/l4/stream.rs +++ b/pingora-core/src/protocols/l4/stream.rs @@ -150,6 +150,8 @@ impl AsRawSocket for RawStream { fn as_raw_socket(&self) -> std::os::windows::io::RawSocket { match self { RawStream::Tcp(s) => s.as_raw_socket(), + // Virtual stream does not have a real socket, return INVALID_SOCKET (!0) + RawStream::Virtual(_) => !0, } } }