Commit 131ede28 authored by dscho's avatar dscho

pthread fix

parent af41bea6
...@@ -328,6 +328,7 @@ listenerRun(void *data) ...@@ -328,6 +328,7 @@ listenerRun(void *data)
if (cl && !cl->onHold ) if (cl && !cl->onHold )
rfbStartOnHoldClient(cl); rfbStartOnHoldClient(cl);
} }
return(NULL);
} }
void void
......
...@@ -448,9 +448,14 @@ rfbProcessClientProtocolVersion(cl) ...@@ -448,9 +448,14 @@ rfbProcessClientProtocolVersion(cl)
pv[sz_rfbProtocolVersionMsg] = 0; pv[sz_rfbProtocolVersionMsg] = 0;
if (sscanf(pv,rfbProtocolVersionFormat,&major_,&minor_) != 2) { if (sscanf(pv,rfbProtocolVersionFormat,&major_,&minor_) != 2) {
rfbLog("rfbProcessClientProtocolVersion: not a valid RFB client\n"); char name[1024];
rfbCloseClient(cl); if(sscanf(pv,"RFB %03d.%03d %1024s\n",&major_,&minor_,name) != 3) {
return; rfbLog("rfbProcessClientProtocolVersion: not a valid RFB client\n");
rfbCloseClient(cl);
return;
}
free(cl->host);
cl->host=strdup(name);
} }
rfbLog("Protocol version %d.%d\n", major_, minor_); rfbLog("Protocol version %d.%d\n", major_, minor_);
......
...@@ -309,12 +309,18 @@ rfbCloseClient(cl) ...@@ -309,12 +309,18 @@ rfbCloseClient(cl)
rfbClientPtr cl; rfbClientPtr cl;
{ {
LOCK(cl->updateMutex); LOCK(cl->updateMutex);
if (cl->sock != -1) { #ifdef HAVE_PTHREADS
FD_CLR(cl->sock,&(cl->screen->allFds)); if (cl->sock != -1)
shutdown(cl->sock,SHUT_RDWR); #endif
close(cl->sock); {
cl->sock = -1; FD_CLR(cl->sock,&(cl->screen->allFds));
} if(cl->sock==cl->screen->maxFd)
while(!FD_ISSET(cl->screen->maxFd,&(cl->screen->allFds)))
cl->screen->maxFd--;
shutdown(cl->sock,SHUT_RDWR);
close(cl->sock);
cl->sock = -1;
}
TSIGNAL(cl->updateCond); TSIGNAL(cl->updateCond);
UNLOCK(cl->updateMutex); UNLOCK(cl->updateMutex);
} }
......
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