|
|
@ -314,8 +314,14 @@ static void *
|
|
|
|
clientInput(void *data)
|
|
|
|
clientInput(void *data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rfbClientPtr cl = (rfbClientPtr)data;
|
|
|
|
rfbClientPtr cl = (rfbClientPtr)data;
|
|
|
|
pthread_t output_thread;
|
|
|
|
|
|
|
|
pthread_create(&output_thread, NULL, clientOutput, (void *)cl);
|
|
|
|
/* Start output thread */
|
|
|
|
|
|
|
|
TQEventLoopThread* clientOutputHandlerThread = new TQEventLoopThread();
|
|
|
|
|
|
|
|
ClientOutputHandlerObject* clientOutputHandler = new ClientOutputHandlerObject();
|
|
|
|
|
|
|
|
clientOutputHandler->d = cl;
|
|
|
|
|
|
|
|
clientOutputHandler->moveToThread(clientOutputHandlerThread);
|
|
|
|
|
|
|
|
TQTimer::singleShot(0, clientOutputHandler, SLOT(run()));
|
|
|
|
|
|
|
|
clientOutputHandlerThread->start();
|
|
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
while (1) {
|
|
|
|
rfbProcessClientMessage(cl);
|
|
|
|
rfbProcessClientMessage(cl);
|
|
|
@ -325,11 +331,15 @@ clientInput(void *data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Get rid of the output thread. */
|
|
|
|
/* Get rid of the output thread */
|
|
|
|
LOCK(cl->updateMutex);
|
|
|
|
LOCK(cl->updateMutex);
|
|
|
|
TSIGNAL(cl->updateCond);
|
|
|
|
TSIGNAL(cl->updateCond);
|
|
|
|
UNLOCK(cl->updateMutex);
|
|
|
|
UNLOCK(cl->updateMutex);
|
|
|
|
IF_PTHREADS(pthread_join(output_thread, NULL));
|
|
|
|
clientOutputHandlerThread->wait();
|
|
|
|
|
|
|
|
delete clientOutputHandlerThread;
|
|
|
|
|
|
|
|
clientOutputHandlerThread = NULL;
|
|
|
|
|
|
|
|
delete clientOutputHandler;
|
|
|
|
|
|
|
|
clientOutputHandler = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
rfbClientConnectionGone(cl);
|
|
|
|
rfbClientConnectionGone(cl);
|
|
|
|
|
|
|
|
|
|
|
@ -652,6 +662,21 @@ void rfbScreenCleanup(rfbScreenInfoPtr rfbScreen)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rfbReleaseClientIterator(i);
|
|
|
|
rfbReleaseClientIterator(i);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mOnHoldClientHandlerThread) {
|
|
|
|
|
|
|
|
mOnHoldClientHandlerThread->exit();
|
|
|
|
|
|
|
|
delete mOnHoldClientHandlerThread;
|
|
|
|
|
|
|
|
mOnHoldClientHandlerThread = NULL;
|
|
|
|
|
|
|
|
delete mOnHoldClientHandler;
|
|
|
|
|
|
|
|
mOnHoldClientHandler = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mControlPipeHandlerThread) {
|
|
|
|
|
|
|
|
mControlPipeHandlerThread->exit();
|
|
|
|
|
|
|
|
delete mControlPipeHandlerThread;
|
|
|
|
|
|
|
|
mControlPipeHandlerThread = NULL;
|
|
|
|
|
|
|
|
delete mControlPipeHandler;
|
|
|
|
|
|
|
|
mControlPipeHandler = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* TODO: hang up on all clients and free all reserved memory */
|
|
|
|
/* TODO: hang up on all clients and free all reserved memory */
|
|
|
|
#define FREE_IF(x) if(rfbScreen->x) free(rfbScreen->x)
|
|
|
|
#define FREE_IF(x) if(rfbScreen->x) free(rfbScreen->x)
|
|
|
|
FREE_IF(colourMap.data.bytes);
|
|
|
|
FREE_IF(colourMap.data.bytes);
|
|
|
@ -767,6 +792,9 @@ ControlPipeHandlerObject::~ControlPipeHandlerObject() {
|
|
|
|
|
|
|
|
|
|
|
|
void ControlPipeHandlerObject::run(void) {
|
|
|
|
void ControlPipeHandlerObject::run(void) {
|
|
|
|
listenerRun(d);
|
|
|
|
listenerRun(d);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Terminate thread
|
|
|
|
|
|
|
|
TQThread::exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OnHoldClientHandlerObject::OnHoldClientHandlerObject() : TQObject() {
|
|
|
|
OnHoldClientHandlerObject::OnHoldClientHandlerObject() : TQObject() {
|
|
|
@ -779,6 +807,24 @@ OnHoldClientHandlerObject::~OnHoldClientHandlerObject() {
|
|
|
|
|
|
|
|
|
|
|
|
void OnHoldClientHandlerObject::run(void) {
|
|
|
|
void OnHoldClientHandlerObject::run(void) {
|
|
|
|
clientInput(d);
|
|
|
|
clientInput(d);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Terminate thread
|
|
|
|
|
|
|
|
TQThread::exit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ClientOutputHandlerObject::ClientOutputHandlerObject() : TQObject() {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ClientOutputHandlerObject::~ClientOutputHandlerObject() {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ClientOutputHandlerObject::run(void) {
|
|
|
|
|
|
|
|
clientOutput(d);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Terminate thread
|
|
|
|
|
|
|
|
TQThread::exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "main.moc"
|
|
|
|
#include "main.moc"
|