Merge remote-tracking branch 'upstream/master' into marge

This commit is contained in:
Brad Davis 2015-07-20 17:26:36 -07:00
commit 51973674f5
6 changed files with 24 additions and 31 deletions

View file

@ -2691,7 +2691,7 @@ int Application::sendNackPackets() {
// if there are octree packets from this node that are waiting to be processed,
// don't send a NACK since the missing packets may be among those waiting packets.
if (_octreeProcessor.hasPacketsToProcessFrom(nodeUUID)) {
packetsSent = 0;
return;
}
_octreeSceneStatsLock.lockForRead();
@ -2699,16 +2699,16 @@ int Application::sendNackPackets() {
// retreive octree scene stats of this node
if (_octreeServerSceneStats.find(nodeUUID) == _octreeServerSceneStats.end()) {
_octreeSceneStatsLock.unlock();
packetsSent = 0;
return;
}
// get sequence number stats of node, prune its missing set, and make a copy of the missing set
SequenceNumberStats& sequenceNumberStats = _octreeServerSceneStats[nodeUUID].getIncomingOctreeSequenceNumberStats();
sequenceNumberStats.pruneMissingSet();
const QSet<OCTREE_PACKET_SEQUENCE> missingSequenceNumbers = sequenceNumberStats.getMissingSet();
_octreeSceneStatsLock.unlock();
// construct nack packet(s) for this node
auto it = missingSequenceNumbers.constBegin();
while (it != missingSequenceNumbers.constEnd()) {
@ -2716,10 +2716,10 @@ int Application::sendNackPackets() {
nackPacketList.writePrimitive(missingNumber);
++it;
}
if (nackPacketList.getNumPackets()) {
packetsSent += nackPacketList.getNumPackets();
// send the packet list
nodeList->sendPacketList(nackPacketList, *node);
}

View file

@ -64,13 +64,7 @@ std::unique_ptr<NLPacket> NLPacket::fromReceivedPacket(std::unique_ptr<char> dat
}
std::unique_ptr<NLPacket> NLPacket::createCopy(const NLPacket& other) {
auto packet = std::unique_ptr<NLPacket>(new NLPacket(other));
if (other.isOpen()) {
packet->open(other.openMode());
}
return packet;
return std::unique_ptr<NLPacket>(new NLPacket(other));
}
NLPacket::NLPacket(PacketType::Value type, qint64 size) :

View file

@ -44,13 +44,7 @@ std::unique_ptr<Packet> Packet::fromReceivedPacket(std::unique_ptr<char> data, q
}
std::unique_ptr<Packet> Packet::createCopy(const Packet& other) {
auto packet = std::unique_ptr<Packet>(new Packet(other));
if (other.isOpen()) {
packet->open(other.openMode());
}
return packet;
return std::unique_ptr<Packet>(new Packet(other));
}
qint64 Packet::totalHeadersSize() const {
@ -104,6 +98,11 @@ Packet::Packet(const Packet& other) :
QIODevice()
{
*this = other;
if (other.isOpen()) {
this->open(other.openMode());
}
this->seek(other.pos());
}

View file

@ -81,7 +81,7 @@ public:
using QIODevice::read;
QByteArray read(qint64 maxSize);
template<typename T> qint64 peekPrimitive(T* data);
template<typename T> qint64 readPrimitive(T* data);
template<typename T> qint64 writePrimitive(const T& data);

View file

@ -69,7 +69,7 @@ PacketVersion versionForPacketType(PacketType::Value packetType) {
case EntityData:
return VERSION_ENTITIES_NEW_PROTOCOL_LAYER;
default:
return 10;
return 11;
}
}

View file

@ -27,7 +27,7 @@
// NOTE: if you want the name of the packet packetType to be available for debugging or logging, update nameForPacketType() as well
namespace PacketType {
enum Value {
enum Value {
Unknown,
StunResponse,
DomainList,
@ -62,18 +62,18 @@ namespace PacketType {
DomainConnectRequest,
DomainServerRequireDTLS,
NodeJsonStats,
EntityQuery,
EntityData,
EntityAdd,
EntityErase,
EntityEdit,
OctreeDataNack,
StopNode,
AudioEnvironment,
EntityEditNack,
ICEServerHeartbeat,
ICEPing,
ICEPingReply
ICEPingReply,
EntityData,
EntityQuery,
EntityAdd,
EntityErase,
EntityEdit
};
};
@ -138,6 +138,6 @@ const PacketVersion VERSION_ENTITIES_FACE_CAMERA = 30;
const PacketVersion VERSION_ENTITIES_SCRIPT_TIMESTAMP = 31;
const PacketVersion VERSION_ENTITIES_SCRIPT_TIMESTAMP_FIX = 32;
const PacketVersion VERSION_ENTITIES_HAVE_SIMULATION_OWNER_AND_ACTIONS_OVER_WIRE = 33;
const PacketVersion VERSION_ENTITIES_NEW_PROTOCOL_LAYER = 34;
const PacketVersion VERSION_ENTITIES_NEW_PROTOCOL_LAYER = 35;
#endif // hifi_PacketHeaders_h