[Spice-commits] vdservice/virtio_vdi_port.cpp

Arnon Gilboa agilboa at kemper.freedesktop.org
Mon Aug 1 03:01:02 PDT 2011


 vdservice/virtio_vdi_port.cpp |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 6b225e96d45ab9c830632320882b47d3aa93be0a
Author: Arnon Gilboa <agilboa at redhat.com>
Date:   Mon Aug 1 11:25:02 2011 +0300

    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).

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;


More information about the Spice-commits mailing list