diff options
author | dscho <dscho> | 2002-02-18 06:43:54 +0000 |
---|---|---|
committer | dscho <dscho> | 2002-02-18 06:43:54 +0000 |
commit | 45a4b4a2235adecc925182b27959db62b5954a26 (patch) | |
tree | de00aee4fd77b81f768d00416c9eda47d21e22b3 /rfbserver.c | |
parent | fbf2c977fe4c70fa2e551ecc0264c4b8184386f2 (diff) | |
download | libtdevnc-45a4b4a2235adecc925182b27959db62b5954a26.tar.gz libtdevnc-45a4b4a2235adecc925182b27959db62b5954a26.zip |
changes from Tim Jansen: threading issues, new client can be rejected, and more
Diffstat (limited to 'rfbserver.c')
-rw-r--r-- | rfbserver.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/rfbserver.c b/rfbserver.c index b938d91..2190aef 100644 --- a/rfbserver.c +++ b/rfbserver.c @@ -61,7 +61,7 @@ void rfbDecrClientRef(rfbClientPtr cl) LOCK(cl->refCountMutex); cl->refCount--; if(cl->refCount<=0) /* just to be sure also < 0 */ - SIGNAL(cl->deleteCond); + TSIGNAL(cl->deleteCond); UNLOCK(cl->refCountMutex); } #endif @@ -271,14 +271,29 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP) if (WriteExact(cl, pv, sz_rfbProtocolVersionMsg) < 0) { rfbLogPerror("rfbNewClient: write"); rfbCloseClient(cl); + /* TODO: memory leak here (cl is never freed) + * can rfbClientConnectionGone called at this time? + * tim@tjansen.de + */ return NULL; } } cl->clientData = NULL; cl->clientGoneHook = doNothingWithClient; - cl->screen->newClientHook(cl); - + switch (cl->screen->newClientHook(cl)) { + case RFB_CLIENT_ON_HOLD: + cl->onHold = TRUE; + break; + case RFB_CLIENT_ACCEPT: + cl->onHold = FALSE; + break; + case RFB_CLIENT_REFUSE: + rfbCloseClient(cl); + rfbClientConnectionGone(cl); + cl = NULL; + break; + } return cl; } @@ -781,7 +796,7 @@ rfbProcessClientNormalMessage(cl) sraRgnOr(cl->modifiedRegion,tmpRegion); sraRgnSubtract(cl->copyRegion,tmpRegion); } - SIGNAL(cl->updateCond); + TSIGNAL(cl->updateCond); UNLOCK(cl->updateMutex); sraRgnDestroy(tmpRegion); @@ -1431,7 +1446,7 @@ rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen) rfbClientPtr cl=rfbScreen->udpClient; rfbClientToServerMsg msg; - if(!cl) + if((!cl) || cl->onHold) return; if ((n = read(rfbScreen->udpSock, (char *)&msg, sizeof(msg))) <= 0) { |