rfbClientLog("Command line errors are not reported until "
"a connection comes in.\n");
- while (TRUE) {
+ while (client->listenSpecified) {
/* reap any zombies */
int status, pid;
FD_SET(listenSocket, &fds);
- select(FD_SETSIZE, &fds, NULL, NULL, NULL);
+ //100ms
+ struct timeval timeout;
+ timeout.tv_sec=0;
+ timeout.tv_usec=100000;
+
+ select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
if (FD_ISSET(listenSocket, &fds)) {
client->sock = AcceptTcpConnection(listenSocket);
//modified to accept only a single connection
//if something goes wrong, we can always create another listening socket
rfbClientLog("Accepted connection.\n");
- close(listenSocket);
- return;
+ break;
-// /* Now fork off a new process to deal with it... */
-//
-// switch (fork()) {
-//
-// case -1:
-// rfbClientErr("fork\n");
-// return;
-//
-// case 0:
-// /* child - return to caller */
-// close(listenSocket);
-// return;
-//
-// default:
-// /* parent - go round and listen again */
-// close(client->sock);
-// break;
-// }
- }
+ }
}
+
+ close(listenSocket);
#endif
}
#endif
#include "connectdialog.h"
+#include "rfb/rfbclient.h"
ConnectDialog::ConnectDialog(QWidget *parent):
QSettings settings;
if(!hosts.itemIcon(hosts.currentIndex()).isNull()) {
- int listen_port = settings.value("listen_port", 5500).toInt();
+ int listen_port = settings.value("listen_port", LISTEN_PORT_OFFSET).toInt();
+#if QT_VERSION >= 0x040500
//ask user if listen_port is correct
bool ok;
listen_port = QInputDialog::getInt(this,
tr("Listen on Port:"),
listen_port, 1, 65535, //value, min, max
1, &ok);
+#else
+ bool ok = true;
+#endif
if(ok) {
settings.setValue("listen_port", listen_port);
emit connectToHost("", quality, listen_port);
: QThread(parent)
, frameBuffer(0)
{
+ outputErrorMessageString.clear(); //don't deliver error messages of old instances...
QMutexLocker locker(&mutex);
m_stopped = false;
void VncClientThread::stop()
{
- QMutexLocker locker(&mutex);
+ if(m_stopped)
+ return;
- m_stopped = true;
+ //also abort listening for connections, should be safe without locking
+ if(listen_port)
+ cl->listenSpecified = false;
+
+ QMutexLocker locker(&mutex);
+ m_stopped = true;
}
void VncClientThread::run()
{
QMutexLocker locker(&mutex);
- bool clean = false;
int passwd_failures = 0;
while (!m_stopped) { // try to connect as long as the server allows
passwd_failures++;
if(passwd_failures > 2) {
m_stopped = true;
- clean = true; //rfbInitClient cleans up after itself upon failure
+ return;
}
continue;
}
+ //clean, just exit
+ m_stopped = true;
return;
}
// Cleanup allocated resources
locker.relock();
- if(!clean)
- rfbClientCleanup(cl);
+ rfbClientCleanup(cl);
m_stopped = true;
}
QHBoxLayout layout1;
QVBoxLayout layout2;
layout2.addWidget(&passwordbox);
- layout2.addWidget(&save_password);
+ if(!m_host.isEmpty()) //don't save incomming connections
+ layout2.addWidget(&save_password);
layout1.addLayout(&layout2);
layout1.addWidget(&ok_button);
dialog.setLayout(&layout1);
if(dialog.exec()) { //dialog accepted
password = passwordbox.text();
- if(save_password.isChecked()) {
+ if(!m_host.isEmpty() and save_password.isChecked()) {
kDebug(5011) << "Saving password for host '" << m_host << "'";
settings.setValue(QString("%1/password").arg(m_host), password);
void VncView::outputErrorMessage(const QString &message)
{
- kDebug(5011) << message;
-
if (message == "INTERNAL:APPLE_VNC_COMPATIBILTY") {
setCursor(localDotCursor());
m_forceLocalCursor = true;
TARGET = presencevnc-bin
LIBS += -Llibvnc/libvncclient/.libs -lvncclient
DEFINES += QTONLY
-CONFIG += silent release
+CONFIG += silent debug
maemo5 {
QT += maemo5