leverage the VerboseLoggingHelper for packets from unknown nodes

This commit is contained in:
Stephen Birarda 2014-10-28 12:15:52 -07:00
parent 9c30903eb6
commit 8a4c716452
2 changed files with 8 additions and 3 deletions

View file

@ -19,6 +19,8 @@
#include <QtCore/QUrl> #include <QtCore/QUrl>
#include <QtNetwork/QHostInfo> #include <QtNetwork/QHostInfo>
#include <VerboseLoggingHelper.h>
#include "AccountManager.h" #include "AccountManager.h"
#include "Assignment.h" #include "Assignment.h"
#include "HifiSockAddr.h" #include "HifiSockAddr.h"
@ -211,8 +213,10 @@ bool LimitedNodeList::packetVersionAndHashMatch(const QByteArray& packet) {
<< uuidFromPacketHeader(packet); << uuidFromPacketHeader(packet);
} }
} else { } else {
qDebug() << "Packet of type" << checkType << "received from unknown node with UUID" QString unknownPacketString = "%1 packets of type " + QString::number(checkType)
<< uuidFromPacketHeader(packet); + " received from unknown node with UUID "
+ uuidStringWithoutCurlyBraces(uuidFromPacketHeader(packet));
VerboseLoggingHelper::getInstance().addMessage(unknownPacketString);
} }
} else { } else {
return true; return true;

View file

@ -28,7 +28,8 @@ VerboseLoggingHelper::VerboseLoggingHelper() {
void VerboseLoggingHelper::flushMessages() { void VerboseLoggingHelper::flushMessages() {
QHash<QString, int>::iterator message = _messageCountHash.begin(); QHash<QString, int>::iterator message = _messageCountHash.begin();
while (message != _messageCountHash.end()) { while (message != _messageCountHash.end()) {
qDebug() << message.key().arg(message.value()); qDebug() << qPrintable(message.key().arg(message.value()))
<< "in last" << VERBOSE_LOG_INTERVAL_SECONDS << "seconds.";
message = _messageCountHash.erase(message); message = _messageCountHash.erase(message);
} }
} }