Merge branch 'master' of https://github.com/synergy/synergy
This commit is contained in:
commit
673fba5846
|
@ -1351,3 +1351,12 @@ QString MainWindow::getProfileRootForArg()
|
||||||
|
|
||||||
return QString("\"%1\"").arg(dir);
|
return QString("\"%1\"").arg(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::delay(unsigned int s)
|
||||||
|
{
|
||||||
|
QTime dieTime= QTime::currentTime().addSecs(s);
|
||||||
|
|
||||||
|
while( QTime::currentTime() < dieTime ) {
|
||||||
|
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
|
|
||||||
friend class QSynergyApplication;
|
friend class QSynergyApplication;
|
||||||
friend class SetupWizard;
|
friend class SetupWizard;
|
||||||
|
friend class PluginWizardPage;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum qSynergyState
|
enum qSynergyState
|
||||||
|
@ -108,6 +109,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
void serverDetected(const QString name);
|
void serverDetected(const QString name);
|
||||||
void setEdition(int type);
|
void setEdition(int type);
|
||||||
void updateLocalFingerprint();
|
void updateLocalFingerprint();
|
||||||
|
void delay(unsigned int);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void appendLogRaw(const QString& text);
|
void appendLogRaw(const QString& text);
|
||||||
|
|
|
@ -22,16 +22,18 @@
|
||||||
#include "FileSysClient.h"
|
#include "FileSysClient.h"
|
||||||
#include "WebClient.h"
|
#include "WebClient.h"
|
||||||
#include "PluginManager.h"
|
#include "PluginManager.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
|
|
||||||
#include <QMovie>
|
#include <QMovie>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
PluginWizardPage::PluginWizardPage(AppConfig& appConfig, QWidget *parent) :
|
PluginWizardPage::PluginWizardPage(MainWindow& mainWindow, QWidget *parent) :
|
||||||
QWizardPage(parent),
|
QWizardPage(parent),
|
||||||
m_Finished(false),
|
m_Finished(false),
|
||||||
m_pFileSysClient(NULL),
|
m_pFileSysClient(NULL),
|
||||||
m_pSslCertificate(NULL),
|
m_pSslCertificate(NULL),
|
||||||
m_AppConfig(appConfig)
|
m_mainWindow(mainWindow)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
@ -77,14 +79,18 @@ void PluginWizardPage::queryPluginDone()
|
||||||
showFinished();
|
showFinished();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
m_mainWindow.stopSynergy();
|
||||||
|
m_mainWindow.delay(5);
|
||||||
copyPlugins();
|
copyPlugins();
|
||||||
|
m_mainWindow.startSynergy();
|
||||||
|
m_mainWindow.delay(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginWizardPage::finished()
|
void PluginWizardPage::finished()
|
||||||
{
|
{
|
||||||
// TODO: we should check if ns plugin exists
|
// TODO: we should check if ns plugin exists
|
||||||
m_AppConfig.setCryptoEnabled(true);
|
m_mainWindow.appConfig().setCryptoEnabled(true);
|
||||||
|
|
||||||
updateStatus(tr("Plugins installed successfully."));
|
updateStatus(tr("Plugins installed successfully."));
|
||||||
showFinished();
|
showFinished();
|
||||||
|
|
|
@ -27,13 +27,14 @@
|
||||||
class FileSysClient;
|
class FileSysClient;
|
||||||
class WebClient;
|
class WebClient;
|
||||||
class SslCertificate;
|
class SslCertificate;
|
||||||
|
class MainWindow;
|
||||||
|
|
||||||
class PluginWizardPage : public QWizardPage, public Ui::PluginWizardPage {
|
class PluginWizardPage : public QWizardPage, public Ui::PluginWizardPage {
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PluginWizardPage(AppConfig& appConfig, QWidget *parent = 0);
|
PluginWizardPage(MainWindow& mainWindow, QWidget *parent = 0);
|
||||||
~PluginWizardPage();
|
~PluginWizardPage();
|
||||||
|
|
||||||
void setFinished(bool b) { m_Finished = b; }
|
void setFinished(bool b) { m_Finished = b; }
|
||||||
|
@ -66,6 +67,6 @@ private:
|
||||||
PluginManager m_PluginManager;
|
PluginManager m_PluginManager;
|
||||||
SslCertificate* m_pSslCertificate;
|
SslCertificate* m_pSslCertificate;
|
||||||
QThread* m_pThread;
|
QThread* m_pThread;
|
||||||
AppConfig& m_AppConfig;
|
MainWindow& m_mainWindow;
|
||||||
};
|
};
|
||||||
#endif // PLUGINWIZARDPAGE_H
|
#endif // PLUGINWIZARDPAGE_H
|
||||||
|
|
|
@ -30,7 +30,7 @@ SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
|
||||||
m_Edition(Unknown)
|
m_Edition(Unknown)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
m_pPluginPage = new PluginWizardPage(mainWindow.appConfig());
|
m_pPluginPage = new PluginWizardPage(mainWindow);
|
||||||
addPage(m_pPluginPage);
|
addPage(m_pPluginPage);
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
|
|
|
@ -35,6 +35,7 @@ typedef void (*cleanupFunc)();
|
||||||
|
|
||||||
void* g_eventTarget = NULL;
|
void* g_eventTarget = NULL;
|
||||||
IEventQueue* g_events = NULL;
|
IEventQueue* g_events = NULL;
|
||||||
|
static const char kPre174Plugin[] = "Pre-1.7.4";
|
||||||
|
|
||||||
ArchPluginUnix::ArchPluginUnix()
|
ArchPluginUnix::ArchPluginUnix()
|
||||||
{
|
{
|
||||||
|
@ -82,7 +83,13 @@ ArchPluginUnix::load()
|
||||||
|
|
||||||
String filename = synergy::string::removeFileExt(*it);
|
String filename = synergy::string::removeFileExt(*it);
|
||||||
m_pluginTable.insert(std::make_pair(filename, library));
|
m_pluginTable.insert(std::make_pair(filename, library));
|
||||||
LOG((CLOG_DEBUG "loaded plugin: %s", (*it).c_str()));
|
|
||||||
|
const char * version = (char*)invoke( filename.c_str(),"version",NULL);
|
||||||
|
if (version == NULL) {
|
||||||
|
version = kPre174Plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG((CLOG_DEBUG "loaded plugin: %s (%s)", (*it).c_str(),version));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ typedef void (*cleanupFunc)();
|
||||||
|
|
||||||
void* g_eventTarget = NULL;
|
void* g_eventTarget = NULL;
|
||||||
IEventQueue* g_events = NULL;
|
IEventQueue* g_events = NULL;
|
||||||
|
static const char * kPre174Plugin = "Pre-1.7.v";
|
||||||
|
|
||||||
ArchPluginWindows::ArchPluginWindows()
|
ArchPluginWindows::ArchPluginWindows()
|
||||||
{
|
{
|
||||||
|
@ -69,9 +70,9 @@ ArchPluginWindows::load()
|
||||||
String filename = synergy::string::removeFileExt(*it);
|
String filename = synergy::string::removeFileExt(*it);
|
||||||
m_pluginTable.insert(std::make_pair(filename, lib));
|
m_pluginTable.insert(std::make_pair(filename, lib));
|
||||||
|
|
||||||
char * version = (char*)invoke( filename.c_str(),"version",NULL);
|
const char * version = (char*)invoke( filename.c_str(),"version",NULL);
|
||||||
if (version == NULL) {
|
if (version == NULL) {
|
||||||
version = "Pre-1.7.4";
|
version = kPre174Plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG((CLOG_DEBUG "loaded plugin: %s (%s)", (*it).c_str(),version));
|
LOG((CLOG_DEBUG "loaded plugin: %s (%s)", (*it).c_str(),version));
|
||||||
|
|
|
@ -299,6 +299,7 @@ SecureSocket::secureAccept(int socket)
|
||||||
LOG((CLOG_INFO "client connection may not be secure"));
|
LOG((CLOG_INFO "client connection may not be secure"));
|
||||||
m_secureReady = false;
|
m_secureReady = false;
|
||||||
ARCH->sleep(1);
|
ARCH->sleep(1);
|
||||||
|
retry = 0;
|
||||||
return -1; // Failed, error out
|
return -1; // Failed, error out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,6 +343,7 @@ SecureSocket::secureConnect(int socket)
|
||||||
|
|
||||||
if (isFatal()) {
|
if (isFatal()) {
|
||||||
LOG((CLOG_ERR "failed to connect secure socket"));
|
LOG((CLOG_ERR "failed to connect secure socket"));
|
||||||
|
retry = 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,6 +354,7 @@ SecureSocket::secureConnect(int socket)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retry = 0;
|
||||||
// No error, set ready, process and return ok
|
// No error, set ready, process and return ok
|
||||||
m_secureReady = true;
|
m_secureReady = true;
|
||||||
if (verifyCertFingerprint()) {
|
if (verifyCertFingerprint()) {
|
||||||
|
@ -417,23 +420,29 @@ SecureSocket::checkResult(int status, int& retry)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SSL_ERROR_WANT_READ:
|
case SSL_ERROR_WANT_READ:
|
||||||
m_readable = true;
|
|
||||||
retry++;
|
retry++;
|
||||||
LOG((CLOG_DEBUG2 "want to read, error=%d, attempt=%d", errorCode, retry));
|
LOG((CLOG_DEBUG2 "want to read, error=%d, attempt=%d", errorCode, retry));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SSL_ERROR_WANT_WRITE:
|
case SSL_ERROR_WANT_WRITE:
|
||||||
|
// Need to make sure the socket is known to be writable so the impending
|
||||||
|
// select action actually triggers on a write. This isn't necessary for
|
||||||
|
// m_readable because the socket logic is always readable
|
||||||
m_writable = true;
|
m_writable = true;
|
||||||
retry++;
|
retry++;
|
||||||
LOG((CLOG_DEBUG2 "want to write, error=%d, attempt=%d", errorCode, retry));
|
LOG((CLOG_DEBUG2 "want to write, error=%d, attempt=%d", errorCode, retry));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SSL_ERROR_WANT_CONNECT:
|
case SSL_ERROR_WANT_CONNECT:
|
||||||
case SSL_ERROR_WANT_ACCEPT:
|
|
||||||
retry++;
|
retry++;
|
||||||
LOG((CLOG_DEBUG2 "want to connect, error=%d, attempt=%d", errorCode, retry));
|
LOG((CLOG_DEBUG2 "want to connect, error=%d, attempt=%d", errorCode, retry));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SSL_ERROR_WANT_ACCEPT:
|
||||||
|
retry++;
|
||||||
|
LOG((CLOG_DEBUG2 "want to accept, error=%d, attempt=%d", errorCode, retry));
|
||||||
|
break;
|
||||||
|
|
||||||
case SSL_ERROR_SYSCALL:
|
case SSL_ERROR_SYSCALL:
|
||||||
LOG((CLOG_ERR "ssl error occurred (system call failure)"));
|
LOG((CLOG_ERR "ssl error occurred (system call failure)"));
|
||||||
if (ERR_peek_error() == 0) {
|
if (ERR_peek_error() == 0) {
|
||||||
|
@ -595,14 +604,20 @@ SecureSocket::serviceConnect(ISocketMultiplexerJob* job,
|
||||||
status = secureConnect(getSocket()->m_fd);
|
status = secureConnect(getSocket()->m_fd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// If status < 0, error happened
|
||||||
|
if (status < 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If status > 0, success
|
||||||
if (status > 0) {
|
if (status > 0) {
|
||||||
return newJob();
|
return newJob();
|
||||||
}
|
}
|
||||||
else if (status == 0) {
|
|
||||||
return job;
|
// Retry case
|
||||||
}
|
return new TSocketMultiplexerMethodJob<SecureSocket>(
|
||||||
// If status < 0, error happened
|
this, &SecureSocket::serviceConnect,
|
||||||
return NULL;
|
getSocket(), isReadable(), isWritable());
|
||||||
}
|
}
|
||||||
|
|
||||||
ISocketMultiplexerJob*
|
ISocketMultiplexerJob*
|
||||||
|
@ -617,15 +632,20 @@ SecureSocket::serviceAccept(ISocketMultiplexerJob* job,
|
||||||
#elif SYSAPI_UNIX
|
#elif SYSAPI_UNIX
|
||||||
status = secureAccept(getSocket()->m_fd);
|
status = secureAccept(getSocket()->m_fd);
|
||||||
#endif
|
#endif
|
||||||
|
// If status < 0, error happened
|
||||||
|
if (status < 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If status > 0, success
|
||||||
if (status > 0) {
|
if (status > 0) {
|
||||||
return newJob();
|
return newJob();
|
||||||
}
|
}
|
||||||
else if (status == 0) {
|
|
||||||
return job;
|
// Retry case
|
||||||
}
|
return new TSocketMultiplexerMethodJob<SecureSocket>(
|
||||||
// If status < 0, error happened
|
this, &SecureSocket::serviceAccept,
|
||||||
return NULL;
|
getSocket(), isReadable(), isWritable());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue