diff options
author | dscho <dscho> | 2002-06-13 17:41:40 +0000 |
---|---|---|
committer | dscho <dscho> | 2002-06-13 17:41:40 +0000 |
commit | 131ede28a74bb18037f5bfbbe1f9ac8f26546544 (patch) | |
tree | 780775dd3bb5c9c5db82e72d49936216bd928f9c | |
parent | af41bea661790da0f47089f387f58ffec2c875ee (diff) | |
download | libtdevnc-131ede28a74bb18037f5bfbbe1f9ac8f26546544.tar.gz libtdevnc-131ede28a74bb18037f5bfbbe1f9ac8f26546544.zip |
pthread fix
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | rfbserver.c | 11 | ||||
-rw-r--r-- | sockets.c | 18 |
3 files changed, 21 insertions, 9 deletions
@@ -328,6 +328,7 @@ listenerRun(void *data) if (cl && !cl->onHold ) rfbStartOnHoldClient(cl); } + return(NULL); } void diff --git a/rfbserver.c b/rfbserver.c index f936ccc..11aeff6 100644 --- a/rfbserver.c +++ b/rfbserver.c @@ -448,9 +448,14 @@ rfbProcessClientProtocolVersion(cl) pv[sz_rfbProtocolVersionMsg] = 0; if (sscanf(pv,rfbProtocolVersionFormat,&major_,&minor_) != 2) { - rfbLog("rfbProcessClientProtocolVersion: not a valid RFB client\n"); - rfbCloseClient(cl); - return; + char name[1024]; + if(sscanf(pv,"RFB %03d.%03d %1024s\n",&major_,&minor_,name) != 3) { + 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_); @@ -309,12 +309,18 @@ rfbCloseClient(cl) rfbClientPtr cl; { LOCK(cl->updateMutex); - if (cl->sock != -1) { - FD_CLR(cl->sock,&(cl->screen->allFds)); - shutdown(cl->sock,SHUT_RDWR); - close(cl->sock); - cl->sock = -1; - } +#ifdef HAVE_PTHREADS + if (cl->sock != -1) +#endif + { + 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); UNLOCK(cl->updateMutex); } |