diff options
Diffstat (limited to 'libvncserver')
-rw-r--r-- | libvncserver/rfbserver.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index cb37da3..b42a5ea 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -494,6 +494,21 @@ rfbClientConnectionGone(rfbClientPtr cl) if (cl->next) cl->next->prev = cl->prev; + UNLOCK(rfbClientListMutex); + +#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD + if(cl->screen->backgroundLoop != FALSE) { + int i; + do { + LOCK(cl->refCountMutex); + i=cl->refCount; + if(i>0) + WAIT(cl->deleteCond,cl->refCountMutex); + UNLOCK(cl->refCountMutex); + } while(i>0); + } +#endif + if(cl->sock>=0) close(cl->sock); @@ -510,21 +525,6 @@ rfbClientConnectionGone(rfbClientPtr cl) free(cl->beforeEncBuf); free(cl->afterEncBuf); -#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD - if(cl->screen->backgroundLoop != FALSE) { - int i; - do { - LOCK(cl->refCountMutex); - i=cl->refCount; - if(i>0) - WAIT(cl->deleteCond,cl->refCountMutex); - UNLOCK(cl->refCountMutex); - } while(i>0); - } -#endif - - UNLOCK(rfbClientListMutex); - if(cl->sock>=0) FD_CLR(cl->sock,&(cl->screen->allFds)); |