summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorSimon Rettberg2023-03-07 12:17:27 +0100
committerSimon Rettberg2023-03-07 12:17:27 +0100
commitb6455c7d48719eceb1252c80fc16d18438728c82 (patch)
tree422eddeacc7e3e39abf7b70ab796b3efb620f61b /src/client
parent[server] Fix command line (diff)
downloadpvs2-b6455c7d48719eceb1252c80fc16d18438728c82.tar.gz
pvs2-b6455c7d48719eceb1252c80fc16d18438728c82.tar.xz
pvs2-b6455c7d48719eceb1252c80fc16d18438728c82.zip
Add more debug output to discovery part
Diffstat (limited to 'src/client')
-rw-r--r--src/client/net/serverdiscovery.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/net/serverdiscovery.cpp b/src/client/net/serverdiscovery.cpp
index efae165..5076a8b 100644
--- a/src/client/net/serverdiscovery.cpp
+++ b/src/client/net/serverdiscovery.cpp
@@ -106,7 +106,7 @@ void ServerDiscovery::doDiscovery()
// Check if specifig manager IP is given. If not broadcast in whole network.
if (_mgrIP != QHostAddress::Null) {
- qDebug() << "Broadcasting to " << _mgrIP.toString();
+ qDebug() << "Sending discovery to " << _mgrIP.toString();
if (!_packet.writeMessage(&_discoverySocket, _mgrIP, SERVICE_DISCOVERY_PORT))
qDebug("Failed");
} else {
@@ -151,8 +151,10 @@ void ServerDiscovery::onUdpReadyRead()
continue;
_packet.reset();
- if (_packet.readMessage(data, quint32(size)) != NM_READ_OK)
+ if (_packet.readMessage(data, quint32(size)) != NM_READ_OK) {
+ qDebug() << "Corrupt discovery reply from" << addr.toString();
continue;
+ }
// Valid packet, process it:
const QByteArray hash(_packet.getFieldBytes(_HASH));
@@ -162,6 +164,7 @@ void ServerDiscovery::onUdpReadyRead()
// Check if the source IP of the packet matches any of the addresses given in the IP list
if (!Network::isAddressInList(QString::fromUtf8(iplist), addr.toString())) {
+ qDebug() << "Received bogus discovery reply from" << addr.toString() << "... Not in" << iplist;
++_ipErrorCount;
emit error(ErrorType::InvalidIpList, _hashErrorCount);
continue;
@@ -170,6 +173,7 @@ void ServerDiscovery::onUdpReadyRead()
// If so, check if the submitted hash seems valid
if (genSha1(&_nameBytes, &_salt2, &iplist, &port, &cert) != hash && _mgrIP != addr) {
// did not match local session name, or other data was spoofed
+ qDebug() << "Received bogus session name in discovery reply from" << addr.toString();
++_hashErrorCount;
emit error(ErrorType::InvalidHash, _ipErrorCount);
continue;
@@ -184,6 +188,8 @@ void ServerDiscovery::onUdpReadyRead()
const ushort iport = QString::fromUtf8(port).toUShort(&ok);
if (ok) {
emit serverDetected(addr.toString(), quint16(iport), _nameBytes, cert, (_mgrIP == addr));
+ } else {
+ qDebug() << "... but server advertises unparsable port" << port;
}
// Stop the discovery