Add PacketReceiver to LimitedNodeList

This commit is contained in:
Ryan Huffman 2015-07-08 11:14:43 -07:00
parent 5940aee0e7
commit 9d0bffaa19
2 changed files with 7 additions and 0 deletions

View file

@ -48,6 +48,7 @@ LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short
_localSockAddr(),
_publicSockAddr(),
_stunSockAddr(STUN_SERVER_HOSTNAME, STUN_SERVER_PORT),
_packetReceiver(this),
_numCollectedPackets(0),
_numCollectedBytes(0),
_packetStatTimer(),
@ -92,6 +93,8 @@ LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short
// check the local socket right now
updateLocalSockAddr();
connect(_nodeSocket, &QUdpSocket::readyRead, _packetReceiver, &PacketReceiver::processDatagrams);
_packetStatTimer.start();
}

View file

@ -121,6 +121,8 @@ public:
bool packetVersionAndHashMatch(const QByteArray& packet);
PacketReceiver& getPacketReceiver() { return _packetReceiver; }
// QByteArray byteArrayWithPopulatedHeader(PacketType::Value packetType)
// { return byteArrayWithUUIDPopulatedHeader(packetType, _sessionUUID); }
// int populatePacketHeader(QByteArray& packet, PacketType::Value packetType)
@ -305,6 +307,8 @@ protected:
HifiSockAddr _publicSockAddr;
HifiSockAddr _stunSockAddr;
PacketReceiver _packetReceiver;
// XXX can BandwidthRecorder be used for this?
int _numCollectedPackets;
int _numCollectedBytes;