All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix VNC on Windows
@ 2008-04-15  7:21 Hervé Poussineau
  0 siblings, 0 replies; only message in thread
From: Hervé Poussineau @ 2008-04-15  7:21 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

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é

[-- Attachment #2: vnc.patch --]
[-- Type: text/plain, Size: 1052 bytes --]

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-15  7:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15  7:21 [Qemu-devel] [PATCH] Fix VNC on Windows Hervé Poussineau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.