Fixes from code review

This commit is contained in:
Albert Vaca Cintora 2023-07-13 14:56:02 +02:00
parent bb8e67efc9
commit 20750b7d99
4 changed files with 10 additions and 10 deletions

View file

@ -18,7 +18,7 @@ configure_file(dbushelper.h.in ${CMAKE_CURRENT_BINARY_DIR}/dbushelper.h)
add_subdirectory(backends/lan) add_subdirectory(backends/lan)
add_subdirectory(backends/loopback) add_subdirectory(backends/loopback)
option(MDNS_ENABLED "Use MDNS for device discovery" OFF) option(MDNS_ENABLED "Use MDNS for device discovery (under development)" OFF)
if (MDNS_ENABLED) if (MDNS_ENABLED)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS DNSSD) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS DNSSD)
endif() endif()

View file

@ -46,7 +46,7 @@ LanLinkProvider::LanLinkProvider(bool testMode, quint16 udpBroadcastPort, quint1
, m_udpListenPort(udpListenPort) , m_udpListenPort(udpListenPort)
, m_testMode(testMode) , m_testMode(testMode)
, m_combineBroadcastsTimer(this) , m_combineBroadcastsTimer(this)
#ifdef KDECONNET_MDNS #ifdef KDECONNECT_MDNS
, m_mdnsDiscovery(this) , m_mdnsDiscovery(this)
#endif #endif
{ {
@ -107,7 +107,7 @@ void LanLinkProvider::onStart()
broadcastUdpIdentityPacket(); broadcastUdpIdentityPacket();
#ifdef KDECONNET_MDNS #ifdef KDECONNECT_MDNS
m_mdnsDiscovery.startAnnouncing(); m_mdnsDiscovery.startAnnouncing();
m_mdnsDiscovery.startDiscovering(); m_mdnsDiscovery.startDiscovering();
#endif #endif
@ -117,7 +117,7 @@ void LanLinkProvider::onStart()
void LanLinkProvider::onStop() void LanLinkProvider::onStop()
{ {
#ifdef KDECONNET_MDNS #ifdef KDECONNECT_MDNS
m_mdnsDiscovery.stopAnnouncing(); m_mdnsDiscovery.stopAnnouncing();
m_mdnsDiscovery.stopDiscovering(); m_mdnsDiscovery.stopDiscovering();
#endif #endif
@ -146,7 +146,7 @@ void LanLinkProvider::broadcastToNetwork()
Q_ASSERT(m_tcpPort != 0); Q_ASSERT(m_tcpPort != 0);
broadcastUdpIdentityPacket(); broadcastUdpIdentityPacket();
#ifdef KDECONNET_MDNS #ifdef KDECONNECT_MDNS
m_mdnsDiscovery.stopDiscovering(); m_mdnsDiscovery.stopDiscovering();
m_mdnsDiscovery.startDiscovering(); m_mdnsDiscovery.startDiscovering();
#endif #endif

View file

@ -18,7 +18,7 @@
#include "kdeconnectcore_export.h" #include "kdeconnectcore_export.h"
#include "landevicelink.h" #include "landevicelink.h"
#include "server.h" #include "server.h"
#ifdef KDECONNET_MDNS #ifdef KDECONNECT_MDNS
#include "mdnsdiscovery.h" #include "mdnsdiscovery.h"
#endif #endif
@ -93,7 +93,7 @@ private:
const bool m_testMode; const bool m_testMode;
QTimer m_combineBroadcastsTimer; QTimer m_combineBroadcastsTimer;
#ifdef KDECONNET_MDNS #ifdef KDECONNECT_MDNS
MdnsDiscovery m_mdnsDiscovery; MdnsDiscovery m_mdnsDiscovery;
#endif #endif
}; };

View file

@ -21,13 +21,13 @@ MdnsDiscovery::MdnsDiscovery(LanLinkProvider *lanLinkProvider)
{ {
switch (KDNSSD::ServiceBrowser::isAvailable()) { switch (KDNSSD::ServiceBrowser::isAvailable()) {
case KDNSSD::ServiceBrowser::Stopped: case KDNSSD::ServiceBrowser::Stopped:
qWarning() << "mDNS or Avahi daemons are not running, mDNS discovery not available"; qCWarning(KDECONNECT_CORE) << "mDNS or Avahi daemons are not running, mDNS discovery not available";
break; break;
case KDNSSD::ServiceBrowser::Working: case KDNSSD::ServiceBrowser::Working:
qCDebug(KDECONNECT_CORE) << "mDNS discovery is available"; qCDebug(KDECONNECT_CORE) << "mDNS discovery is available";
break; break;
case KDNSSD::ServiceBrowser::Unsupported: case KDNSSD::ServiceBrowser::Unsupported:
qWarning() << "mDNS discovery not available (library built without DNS-SD support)"; qCWarning(KDECONNECT_CORE) << "mDNS discovery not available (library built without DNS-SD support)";
break; break;
} }
} }
@ -63,7 +63,7 @@ void MdnsDiscovery::startAnnouncing()
if (successful) { if (successful) {
qCDebug(KDECONNECT_CORE) << "MDNS published successfully"; qCDebug(KDECONNECT_CORE) << "MDNS published successfully";
} else { } else {
qWarning() << "MDNS failed to publish"; qCWarning(KDECONNECT_CORE) << "MDNS failed to publish";
} }
}); });