linuxkit / virtsock

Go bindings for virtio and Hyper-V sockets
Other
87 stars 29 forks source link

vsudd: use io.Copy rather than conn.Write #44

Closed djs55 closed 7 years ago

djs55 commented 7 years ago

Previously when writing the framed messages to the vsock connection we could perform a short write and not realise, allowing the stream to desynchronise. This patch uses io.Copy to ensure the length field and the payload are fully read, or an error is returned and the connection is closed (and subsequently re-opened).

This hopefully fixes the problem demonstrated in

https://github.com/linuxkit/linuxkit/pull/702#issuecomment-261573615

Signed-off-by: David Scott dave.scott@docker.com