Merge pull request #16044 from SimonWalton-HiFi/count-dropped-packets

BUGZ-1161: Report count of dropped packets in Socket::checkForReadyReadBackup()
This commit is contained in:
Shannon Romano 2019-08-09 13:16:42 -07:00 committed by GitHub
commit 29cc7e848e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -75,7 +75,7 @@ public:
void each(std::function<void(AvatarMixerSlave& slave)> functor);
#ifdef DEBUG_EVENT_QUEUE
void AvatarMixerSlavePool::queueStats(QJsonObject& stats);
void queueStats(QJsonObject& stats);
#endif
void setNumThreads(int numThreads);

View file

@ -334,12 +334,17 @@ void Socket::checkForReadyReadBackup() {
qCDebug(networking) << "Socket::checkForReadyReadyBackup() last sequence number"
<< (uint32_t) _lastReceivedSequenceNumber << "from" << _lastPacketSockAddr << "-"
<< _lastPacketSizeRead << "bytes";
#ifdef DEBUG_EVENT_QUEUE
qCDebug(networking) << "NodeList event queue size:" << ::hifi::qt::getEventQueueSize(thread());
#endif
// drop all of the pending datagrams on the floor
int droppedCount = 0;
while (_udpSocket.hasPendingDatagrams()) {
_udpSocket.readDatagram(nullptr, 0);
++droppedCount;
}
qCDebug(networking) << "Flushed" << droppedCount << "Packets";
}
}

View file

@ -12,10 +12,10 @@
#include <QtCore/QObject>
#ifdef WIN32
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX)
// Enable event queue debugging
#define DEBUG_EVENT_QUEUE
#endif // WIN32
#endif
namespace hifi { namespace qt {
void addBlockingForbiddenThread(const QString& name, QThread* thread = nullptr);