[Spice-devel] [PATCH vdagent-win] virtio_vdi_port: if async read returns with ERROR_OPERATION_ABORTED, cancel pending (rhbz#725734)
Arnon Gilboa
agilboa at redhat.com
Mon Aug 1 01:27:48 PDT 2011
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 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;
--
1.7.4.1
More information about the Spice-devel
mailing list