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, // 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. // don't send a NACK since the missing packets may be among those waiting packets.
if (_octreeProcessor.hasPacketsToProcessFrom(nodeUUID)) { if (_octreeProcessor.hasPacketsToProcessFrom(nodeUUID)) {
packetsSent = 0; return;
} }
_octreeSceneStatsLock.lockForRead(); _octreeSceneStatsLock.lockForRead();
@ -2699,16 +2699,16 @@ int Application::sendNackPackets() {
// retreive octree scene stats of this node // retreive octree scene stats of this node
if (_octreeServerSceneStats.find(nodeUUID) == _octreeServerSceneStats.end()) { if (_octreeServerSceneStats.find(nodeUUID) == _octreeServerSceneStats.end()) {
_octreeSceneStatsLock.unlock(); _octreeSceneStatsLock.unlock();
packetsSent = 0; return;
} }
// get sequence number stats of node, prune its missing set, and make a copy of the missing set // get sequence number stats of node, prune its missing set, and make a copy of the missing set
SequenceNumberStats& sequenceNumberStats = _octreeServerSceneStats[nodeUUID].getIncomingOctreeSequenceNumberStats(); SequenceNumberStats& sequenceNumberStats = _octreeServerSceneStats[nodeUUID].getIncomingOctreeSequenceNumberStats();
sequenceNumberStats.pruneMissingSet(); sequenceNumberStats.pruneMissingSet();
const QSet<OCTREE_PACKET_SEQUENCE> missingSequenceNumbers = sequenceNumberStats.getMissingSet(); const QSet<OCTREE_PACKET_SEQUENCE> missingSequenceNumbers = sequenceNumberStats.getMissingSet();
_octreeSceneStatsLock.unlock(); _octreeSceneStatsLock.unlock();
// construct nack packet(s) for this node // construct nack packet(s) for this node
auto it = missingSequenceNumbers.constBegin(); auto it = missingSequenceNumbers.constBegin();
while (it != missingSequenceNumbers.constEnd()) { while (it != missingSequenceNumbers.constEnd()) {
@ -2716,10 +2716,10 @@ int Application::sendNackPackets() {
nackPacketList.writePrimitive(missingNumber); nackPacketList.writePrimitive(missingNumber);
++it; ++it;
} }
if (nackPacketList.getNumPackets()) { if (nackPacketList.getNumPackets()) {
packetsSent += nackPacketList.getNumPackets(); packetsSent += nackPacketList.getNumPackets();
// send the packet list // send the packet list
nodeList->sendPacketList(nackPacketList, *node); 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) { std::unique_ptr<NLPacket> NLPacket::createCopy(const NLPacket& other) {
auto packet = std::unique_ptr<NLPacket>(new NLPacket(other)); return std::unique_ptr<NLPacket>(new NLPacket(other));
if (other.isOpen()) {
packet->open(other.openMode());
}
return packet;
} }
NLPacket::NLPacket(PacketType::Value type, qint64 size) : 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) { std::unique_ptr<Packet> Packet::createCopy(const Packet& other) {
auto packet = std::unique_ptr<Packet>(new Packet(other)); return std::unique_ptr<Packet>(new Packet(other));
if (other.isOpen()) {
packet->open(other.openMode());
}
return packet;
} }
qint64 Packet::totalHeadersSize() const { qint64 Packet::totalHeadersSize() const {
@ -104,6 +98,11 @@ Packet::Packet(const Packet& other) :
QIODevice() QIODevice()
{ {
*this = other; *this = other;
if (other.isOpen()) {
this->open(other.openMode());
}
this->seek(other.pos()); this->seek(other.pos());
} }

View file

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

View file

@ -69,7 +69,7 @@ PacketVersion versionForPacketType(PacketType::Value packetType) {
case EntityData: case EntityData:
return VERSION_ENTITIES_NEW_PROTOCOL_LAYER; return VERSION_ENTITIES_NEW_PROTOCOL_LAYER;
default: 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 // NOTE: if you want the name of the packet packetType to be available for debugging or logging, update nameForPacketType() as well
namespace PacketType { namespace PacketType {
enum Value { enum Value {
Unknown, Unknown,
StunResponse, StunResponse,
DomainList, DomainList,
@ -62,18 +62,18 @@ namespace PacketType {
DomainConnectRequest, DomainConnectRequest,
DomainServerRequireDTLS, DomainServerRequireDTLS,
NodeJsonStats, NodeJsonStats,
EntityQuery,
EntityData,
EntityAdd,
EntityErase,
EntityEdit,
OctreeDataNack, OctreeDataNack,
StopNode, StopNode,
AudioEnvironment, AudioEnvironment,
EntityEditNack, EntityEditNack,
ICEServerHeartbeat, ICEServerHeartbeat,
ICEPing, 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 = 31;
const PacketVersion VERSION_ENTITIES_SCRIPT_TIMESTAMP_FIX = 32; const PacketVersion VERSION_ENTITIES_SCRIPT_TIMESTAMP_FIX = 32;
const PacketVersion VERSION_ENTITIES_HAVE_SIMULATION_OWNER_AND_ACTIONS_OVER_WIRE = 33; 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 #endif // hifi_PacketHeaders_h