repairs for NetworkPacket removal

This commit is contained in:
Stephen Birarda 2015-07-07 17:50:32 -07:00
parent 1cfa65a3df
commit 7a9dbd7f2f
2 changed files with 9 additions and 8 deletions

View file

@ -267,19 +267,20 @@ bool PacketSender::nonThreadedProcess() {
while ((packetsSentThisCall < packetsToSendThisCall) && (packetsLeft > 0)) {
lock();
NodePacketPair& packetPair = _packets.pop_front();
NodePacketPair packetPair = std::move(_packets.front());
_packets.pop_front();
packetsLeft = _packets.size();
unlock();
// send the packet through the NodeList...
DependencyManager::get<NodeList>()->sendUnreliablePacket(packetPair->second(), packetPair->first());
DependencyManager::get<NodeList>()->sendUnreliablePacket(packetPair.second, packetPair.first);
packetsSentThisCall++;
_packetsOverCheckInterval++;
_totalPacketsSent++;
int packetSize = packetPair->second()->getSizeWithHeader();
int packetSize = packetPair.second->getSizeWithHeader();
_totalBytesSent += packetSize;
emit packetSent(packetSize);

View file

@ -47,19 +47,19 @@ bool ReceivedPacketProcessor::process() {
}
lock();
QVector<NetworkPacket> currentPackets;
std::list<NodePacketPair> currentPackets;
currentPackets.swap(_packets);
unlock();
foreach(auto& packet, currentPackets) {
foreach(auto& packetPair, currentPackets) {
// TODO: Replace QByteArray() once NLPacket is coming through on receive side
processPacket(packet->first(), QByteArray());
processPacket(packetPair.first, QByteArray());
midProcess();
}
lock();
foreach(auto& packet, currentPackets) {
_nodePacketCounts[packet.getNode()->getUUID()]--;
foreach(auto& packetPair, currentPackets) {
_nodePacketCounts[packetPair.first->getUUID()]--;
}
unlock();