mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-20 11:35:21 +00:00
ed1b415bad
The socket is nonblocking, so it's not guaranteed that it will be possible to read the whole connect command in a single iteration of the event loop. To reproduce: (echo -n 'CONNECT '; sleep 1; echo 1234; cat) | socat STDIO UNIX-CONNECT:vsock.sock This would produce the error: cloud-hypervisor: 5.509209s: <_vsock4> INFO:virtio-devices/src/vsock/unix/muxer.rs:446 -- vsock: error adding local-init connection: UnixRead(Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }) To fix this, if we only get a partial command, we need to save it for future iterations of the event loop, and only proceed once we've read a complete command. Signed-off-by: Alyssa Ross <hi@alyssa.is> (cherry picked from commit 48de8007560f0dae438db53db60b83f6b4fa5c91)