diff options
author | Vic Lee <llyzs@163.com> | 2011-03-07 17:06:40 +0100 |
---|---|---|
committer | Christian Beier <dontmind@freeshell.org> | 2011-03-12 18:49:46 +0100 |
commit | e323d73f915daf00f74160be7b9f50e634ea784d (patch) | |
tree | 1447c2adbaf3e30d2577029ef882fc95fdbc89a1 | |
parent | e832999a58a3db69ab397ec8a583a1d90fec4b01 (diff) | |
download | libtdevnc-e323d73f915daf00f74160be7b9f50e634ea784d.tar.gz libtdevnc-e323d73f915daf00f74160be7b9f50e634ea784d.zip |
Use WaitForMessage instead of sleep in socket reading to fix performance issue.
Signed-off-by: Christian Beier <dontmind@freeshell.org>
-rw-r--r-- | libvncclient/sockets.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/libvncclient/sockets.c b/libvncclient/sockets.c index 4183192..6c8cec1 100644 --- a/libvncclient/sockets.c +++ b/libvncclient/sockets.c @@ -150,14 +150,10 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n) errno=WSAGetLastError(); #endif if (errno == EWOULDBLOCK || errno == EAGAIN) { -#ifndef WIN32 - usleep (10000); -#else - Sleep (10); -#endif /* TODO: ProcessXtEvents(); */ + WaitForMessage(client, 100000); i = 0; } else { rfbClientErr("read (%d: %s)\n",errno,strerror(errno)); @@ -196,14 +192,10 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n) errno=WSAGetLastError(); #endif if (errno == EWOULDBLOCK || errno == EAGAIN) { -#ifndef WIN32 - usleep (10000); -#else - Sleep (10); -#endif /* TODO: ProcessXtEvents(); */ + WaitForMessage(client, 100000); i = 0; } else { rfbClientErr("read (%s)\n",strerror(errno)); |