Skip to content

fix(windows): add missing RawStream::Virtual match arm in `AsRawSoc…#809

Open
soddygo wants to merge 1 commit intocloudflare:mainfrom
soddygo:fix/windows-rawstream-virtual-match
Open

fix(windows): add missing RawStream::Virtual match arm in `AsRawSoc…#809
soddygo wants to merge 1 commit intocloudflare:mainfrom
soddygo:fix/windows-rawstream-virtual-match

Conversation

@soddygo
Copy link

@soddygo soddygo commented Feb 9, 2026

Summary

The #[cfg(windows)] impl AsRawSocket for RawStream in pingora-core/src/protocols/l4/stream.rs is missing a match arm for the RawStream::Virtual(_) variant, causing a compilation error (E0004: non-exhaustive patterns) on Windows targets.

The Virtual variant is defined without any #[cfg] gate and exists on all platforms. The Unix counterpart (AsRawFd for RawStream) already correctly handles this variant by returning -1.

Fix

Added the missing match arm returning !0 (INVALID_SOCKET) for virtual streams, consistent with the Unix implementation:

  • Unix (existing, correct): RawStream::Virtual(_) => -1
  • Windows (added): RawStream::Virtual(_) => !0

Verification

  • Confirmed this is the only #[cfg(windows)] match on RawStream missing the Virtual arm
  • All other match expressions in stream.rs (AsyncRead, AsyncWrite, Drop, etc.) already handle Virtual correctly

…ket` 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 <cursoragent@cursor.com>
@drcaramelsyrup drcaramelsyrup self-assigned this Feb 13, 2026
@drcaramelsyrup drcaramelsyrup added the bug Something isn't working label Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants