From 6b225e96d45ab9c830632320882b47d3aa93be0a Mon Sep 17 00:00:00 2001 From: Arnon Gilboa Date: Mon, 1 Aug 2011 11:25:02 +0300 Subject: virtio_vdi_port: if async read returns with ERROR_OPERATION_ABORTED, cancel pending (rhbz#725734) Therefore in case of virtio-serial ReadFile timeout (new driver behavior), the next VirtioVDIPort::read() call by the service will be performed, since it is now (!_read.pending). --- vdservice/virtio_vdi_port.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'vdservice') diff --git a/vdservice/virtio_vdi_port.cpp b/vdservice/virtio_vdi_port.cpp index ce4d80a..019d97c 100644 --- a/vdservice/virtio_vdi_port.cpp +++ b/vdservice/virtio_vdi_port.cpp @@ -164,10 +164,16 @@ void VirtioVDIPort::read_completion() { DWORD bytes; - if (!GetOverlappedResult(_handle, &_read.overlap, &bytes, FALSE) && - GetLastError() != ERROR_MORE_DATA) { - vd_printf("GetOverlappedResult failed: %u", GetLastError()); - return; + if (!GetOverlappedResult(_handle, &_read.overlap, &bytes, FALSE)) { + DWORD err = GetLastError(); + + if (err == ERROR_OPERATION_ABORTED) { + _read.pending = false; + return; + } else if (err != ERROR_MORE_DATA) { + vd_printf("GetOverlappedResult failed: %u", err); + return; + } } _read.end = _read.ring + (_read.end - _read.ring + bytes) % BUF_SIZE; _read.bytes = bytes; -- cgit v1.2.3