summaryrefslogtreecommitdiff
path: root/vdservice
diff options
context:
space:
mode:
authorArnon Gilboa <agilboa@redhat.com>2011-08-01 11:25:02 +0300
committerArnon Gilboa <agilboa@redhat.com>2011-08-01 11:25:02 +0300
commit6b225e96d45ab9c830632320882b47d3aa93be0a (patch)
tree66e45c74886bc21e0a39ce0e829df5b6d1b6e760 /vdservice
parentc28d7f02744d834812bac000715975d9416c2da2 (diff)
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).
Diffstat (limited to 'vdservice')
-rw-r--r--vdservice/virtio_vdi_port.cpp14
1 files changed, 10 insertions, 4 deletions
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;