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

View file

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