pub struct FrameStreamBridge { /* private fields */ }Expand description
Running libkrun unix-stream bridge for one virtio NIC.
The bridge owns:
- the shared AF_UNIX stream socket (used to trigger shutdown via
shutdown) - a reader thread for guest->host frames
- a writer thread for host->guest frames
The transport is an AF_UNIX stream socket, wrapped in socket2::Socket so
the same code serves Unix hosts and Windows (10 1809+ has native AF_UNIX).
On Unix the launcher hands us one end of a socketpair; on Windows it hands
us the socket it accepted from libkrun on a per-VM path.
The socket is shared via Arc and the reader/writer threads use it through
&Socket (socket2 implements Read/Write for &Socket), rather than
try_clone-ing it three ways: duplicating an AF_UNIX socket handle is
unreliable on Windows (a clone may not observe the peer’s writes), which
silently stalled all guest traffic. Concurrent read + write on one socket is
safe — the directions are independent.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FrameStreamBridge
impl !UnwindSafe for FrameStreamBridge
impl Freeze for FrameStreamBridge
impl Send for FrameStreamBridge
impl Sync for FrameStreamBridge
impl Unpin for FrameStreamBridge
impl UnsafeUnpin for FrameStreamBridge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more