From f2cc582f9fe2db2834d25920f11d736d79b01d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Loi=CC=88c=20PE=CC=81RON?= Date: Sun, 3 May 2020 13:59:34 +0200 Subject: [PATCH 1/2] Use screen name instead of IP address to announce server through zeroconf, same way it is done for client --- src/gui/src/ZeroconfService.cpp | 39 ++++----------------------------- src/gui/src/ZeroconfService.h | 1 - 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/src/gui/src/ZeroconfService.cpp b/src/gui/src/ZeroconfService.cpp index eff56aef8f..461ac13929 100644 --- a/src/gui/src/ZeroconfService.cpp +++ b/src/gui/src/ZeroconfService.cpp @@ -101,27 +101,6 @@ void ZeroconfService::errorHandle(DNSServiceErrorType errorCode) tr("Error code: %1.").arg(errorCode)); } -QString ZeroconfService::getLocalIPAddresses() -{ - QStringList addresses; - foreach (const QHostAddress& address, QNetworkInterface::allAddresses()) { - if (address.protocol() == QAbstractSocket::IPv4Protocol && - address != QHostAddress(QHostAddress::LocalHost)) { - addresses.append(address.toString()); - } - } - - foreach (const QString& preferedIP, preferedIPAddress) { - foreach (const QString& address, addresses) { - if (address.startsWith(preferedIP)) { - return address; - } - } - } - - return ""; -} - bool ZeroconfService::registerService(bool server) { bool result = true; @@ -137,20 +116,10 @@ bool ZeroconfService::registerService(bool server) else { m_pZeroconfRegister = new ZeroconfRegister(this); if (server) { - QString localIP = getLocalIPAddresses(); - if (localIP.isEmpty()) { - QMessageBox::warning( - m_pMainWindow, tr("Synergy Auto Config"), - tr("Failed to get local IP address. " - "Please manually type in server address " - "on your clients")); - } - else { - m_pZeroconfRegister->registerService( - ZeroconfRecord(tr("%1").arg(localIP), - QLatin1String(m_ServerServiceName), QString()), - m_zeroconfServer.serverPort()); - } + m_pZeroconfRegister->registerService( + ZeroconfRecord(tr("%1").arg(m_pMainWindow->getScreenName()), + QLatin1String(m_ServerServiceName), QString()), + m_zeroconfServer.serverPort()); } else { m_pZeroconfRegister->registerService( diff --git a/src/gui/src/ZeroconfService.h b/src/gui/src/ZeroconfService.h index 17fe3bf7e0..d771253235 100644 --- a/src/gui/src/ZeroconfService.h +++ b/src/gui/src/ZeroconfService.h @@ -42,7 +42,6 @@ private slots: void errorHandle(DNSServiceErrorType errorCode); private: - QString getLocalIPAddresses(); bool registerService(bool server); private: From 88bf136d9008c93b3ca2eaf8f2187f365d2755a0 Mon Sep 17 00:00:00 2001 From: Jamie Newbon Date: Sun, 12 Jul 2020 14:45:49 +0100 Subject: [PATCH 2/2] #6722 Updated ChangeLog --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4d1bd22454..547a7a6cf8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,12 +11,13 @@ Bug fixes: - #6601 Update man page with missing crypto option Enhancements: -- #6666 Add doxygen documentation output from piplines +- #6666 Add doxygen documentation output from pipelines - #6674 Debian 10 X11 build for CI - #6714 Added windows core binaries upload to sandor - #6715 Updated language file from Crowdin - #6688 Fully migrate CI from Jenkins to Azure Pipelines - #6718 Action to test PR's for updated changelog +- #6722 Allow servers to be announced by screen name instead of IP Features: - #6538 System-wide config for all system users