Commit e323d73f authored by Vic Lee's avatar Vic Lee Committed by Christian Beier

Use WaitForMessage instead of sleep in socket reading to fix performance issue.

Signed-off-by: 's avatarChristian Beier <dontmind@freeshell.org>
parent e832999a
...@@ -150,14 +150,10 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n) ...@@ -150,14 +150,10 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
errno=WSAGetLastError(); errno=WSAGetLastError();
#endif #endif
if (errno == EWOULDBLOCK || errno == EAGAIN) { if (errno == EWOULDBLOCK || errno == EAGAIN) {
#ifndef WIN32
usleep (10000);
#else
Sleep (10);
#endif
/* TODO: /* TODO:
ProcessXtEvents(); ProcessXtEvents();
*/ */
WaitForMessage(client, 100000);
i = 0; i = 0;
} else { } else {
rfbClientErr("read (%d: %s)\n",errno,strerror(errno)); rfbClientErr("read (%d: %s)\n",errno,strerror(errno));
...@@ -196,14 +192,10 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n) ...@@ -196,14 +192,10 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
errno=WSAGetLastError(); errno=WSAGetLastError();
#endif #endif
if (errno == EWOULDBLOCK || errno == EAGAIN) { if (errno == EWOULDBLOCK || errno == EAGAIN) {
#ifndef WIN32
usleep (10000);
#else
Sleep (10);
#endif
/* TODO: /* TODO:
ProcessXtEvents(); ProcessXtEvents();
*/ */
WaitForMessage(client, 100000);
i = 0; i = 0;
} else { } else {
rfbClientErr("read (%s)\n",strerror(errno)); rfbClientErr("read (%s)\n",strerror(errno));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment