qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Fix VNC on Windows


From: Hervé Poussineau
Subject: [Qemu-devel] [PATCH] Fix VNC on Windows
Date: Tue, 15 Apr 2008 09:21:05 +0200
User-agent: Thunderbird 2.0.0.12 (Windows/20080213)

Hi,

VNC server included in Qemu disconnects its client very often. It is because recv() function returns WSAEWOULDBLOCK when no data is available. Attached patch fixes this problem by not considering WSAEWOULDBLOCK as an error, so prevents disconnecting the client.

The patch also fixes a warning which happens on WIN32 hosts.

Hervé
Index: vnc.c
===================================================================
--- vnc.c       (revision 4186)
+++ vnc.c       (working copy)
@@ -633,8 +633,18 @@
 static int vnc_client_io_error(VncState *vs, int ret, int last_errno)
 {
     if (ret == 0 || ret == -1) {
-       if (ret == -1 && (last_errno == EINTR || last_errno == EAGAIN))
-           return 0;
+    if (ret == -1) {
+        switch (last_errno) {
+            case EINTR:
+            case EAGAIN:
+#ifdef _WIN32
+            case WSAEWOULDBLOCK:
+#endif
+                return 0;
+            default:
+                break;
+        }
+    }
 
        VNC_DEBUG("Closing down client sock %d %d\n", ret, ret < 0 ? last_errno 
: 0);
        qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL);
@@ -2086,10 +2096,10 @@
     struct sockaddr_in iaddr;
 #ifndef _WIN32
     struct sockaddr_un uaddr;
+    const char *p;
 #endif
     int reuse_addr, ret;
     socklen_t addrlen;
-    const char *p;
     VncState *vs = ds ? (VncState *)ds->opaque : vnc_state;
     const char *options;
     int password = 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]