1
0
mirror of https://invent.kde.org/network/krfb synced 2024-07-03 00:18:36 +00:00
krfb crashed sometimes when the user tried to close a connection. Better
locking in libvncserver and an explicit rfbCloseConnection() invocation
before calling quit() should prevent this.

svn path=/trunk/kdenetwork/krfb/; revision=149689
This commit is contained in:
Tim Jansen 2002-04-15 22:54:48 +00:00
parent ca5b15a389
commit 1ef6160d10
8 changed files with 33 additions and 19 deletions

9
TODO
View File

@ -1,12 +1,5 @@
Known bugs:
- when the server closes the connection in kinetd mode krfb crashes for
unknown reasons. (After this kinetd will not accept new connections
because some threads will not be killed properly, use "killall krfb")
Todo (soon):
- fix shutdown connection in kinetd nide
Todo (unscheduled features):
- attach .vnc file to invitations?
- SLP support (or UPnP, or whatever KDE will use)
- NAT traversal support (MIDCOM stun/turn, UPnP)
- look into adding an extension to xfree to improve speed (get noticed of

View File

@ -159,8 +159,6 @@ int main(int argc, char *argv[])
&trayicon, SLOT(prepareQuit()));
QObject::connect(&app, SIGNAL(lastWindowClosed()),
&controller, SLOT(closeConnection()));
QObject::connect(&app, SIGNAL(lastWindowClosed()),
&app, SLOT(quit()));
QObject::connect(&trayicon, SIGNAL(showManageInvitations()),
config, SLOT(showManageInvitationsDialog()));
@ -168,7 +166,7 @@ int main(int argc, char *argv[])
&app, SLOT(quit()));
QObject::connect(&dcopiface, SIGNAL(exitApp()),
&app, SLOT(quit()));
&controller, SLOT(closeConnection()));
QObject::connect(&controller, SIGNAL(sessionRefused()),
&app, SLOT(quit()));
@ -176,6 +174,8 @@ int main(int argc, char *argv[])
&trayicon, SLOT(showConnectedMessage()));
QObject::connect(&controller, SIGNAL(sessionFinished()),
&trayicon, SLOT(showDisconnectedMessage()));
QObject::connect(&controller, SIGNAL(quitApp()),
&app, SLOT(quit()));
sigset_t sigs;
sigemptyset(&sigs);

View File

@ -257,7 +257,8 @@ RFBController::RFBController(Configuration *c) :
allowRemoteControl(false),
connectionNum(0),
configuration(c),
closePending(false)
closePending(false),
forcedClose(false)
{
self = this;
connect(dialog.acceptConnectionButton, SIGNAL(clicked()),
@ -441,13 +442,16 @@ void RFBController::connectionClosed()
idleTimer.stop();
connectionNum--;
state = RFB_WAITING;
emit sessionFinished();
if (forcedClose)
emit quitApp();
else
emit sessionFinished();
}
void RFBController::closeConnection()
{
forcedClose = true;
if (state == RFB_CONNECTED) {
emit sessionFinished();
if (!checkAsyncEvents()) {
asyncMutex.lock();
if (!closePending)

View File

@ -151,6 +151,7 @@ signals:
void sessionEstablished();
void sessionFinished();
void sessionRefused();
void quitApp();
private:
void stopServer(bool xtestUngrab = true);
@ -173,7 +174,9 @@ private:
QMutex asyncMutex;
QPtrList<VNCEvent> asyncQueue;
bool closePending;
bool closePending; // set when libvncserver detected close
bool forcedClose; // set when user closed connection
private slots:
void idleSlot();
void dialogAccepted();

View File

@ -2,7 +2,7 @@
trayicon.cpp
-------------------
begin : Tue Dec 11 2001
copyright : (C) 2001 by Tim Jansen
copyright : (C) 2001-2002 by Tim Jansen
email : tim@tjansen.de
***************************************************************************/

View File

@ -2,7 +2,7 @@
trayicon.h - description
-------------------
begin : Tue Dec 11 2001
copyright : (C) 2001 by Tim Jansen
copyright : (C) 2001-2002 by Tim Jansen
email : tim@tjansen.de
***************************************************************************/

View File

@ -38,6 +38,10 @@ int rfbEnableLogging = 1;
char rfbEndianTest = (_BYTE_ORDER == _LITTLE_ENDIAN);
/* from rfbserver.c */
void rfbIncrClientRef(rfbClientPtr cl);
void rfbDecrClientRef(rfbClientPtr cl);
/*
* rfbLog prints a time-stamped message to the log file (stderr).
*/
@ -265,7 +269,9 @@ clientOutput(void *data)
UNLOCK(cl->updateMutex);
/* Now actually send the update. */
rfbIncrClientRef(cl);
rfbSendFramebufferUpdate(cl, updateRegion);
rfbDecrClientRef(cl);
sraRgnDestroy(updateRegion);
}

View File

@ -56,14 +56,14 @@ static void rfbProcessClientNormalMessage(rfbClientPtr cl);
static void rfbProcessClientInitMessage(rfbClientPtr cl);
#ifdef HAVE_PTHREADS
static void rfbIncrClientRef(rfbClientPtr cl)
void rfbIncrClientRef(rfbClientPtr cl)
{
LOCK(cl->refCountMutex);
cl->refCount++;
UNLOCK(cl->refCountMutex);
}
static void rfbDecrClientRef(rfbClientPtr cl)
void rfbDecrClientRef(rfbClientPtr cl)
{
LOCK(cl->refCountMutex);
cl->refCount--;
@ -71,6 +71,14 @@ static void rfbDecrClientRef(rfbClientPtr cl)
TSIGNAL(cl->deleteCond);
UNLOCK(cl->refCountMutex);
}
#else
void rfbIncrClientRef(rfbClientPtr cl)
{
}
void rfbDecrClientRef(rfbClientPtr cl)
{
}
#endif
MUTEX(rfbClientListMutex);