resolve conflicts on merge with clement/protocol

This commit is contained in:
Stephen Birarda 2015-07-09 13:27:59 -07:00
commit 2417981c9d
8 changed files with 26 additions and 24 deletions

View file

@ -408,7 +408,6 @@ void AvatarMixer::readPendingDatagrams() {
break;
}
case PacketType::AvatarIdentity: {
// check if we have a matching node in our list
SharedNodePointer avatarNode = nodeList->sendingNodeForPacket(receivedPacket);
@ -425,7 +424,6 @@ void AvatarMixer::readPendingDatagrams() {
break;
}
case PacketType::AvatarBillboard: {
// check if we have a matching node in our list
SharedNodePointer avatarNode = nodeList->sendingNodeForPacket(receivedPacket);

View file

@ -14,7 +14,6 @@
#include <iostream>
#include <CoverageMap.h>
#include <NodeData.h>
#include <OctreeConstants.h>
@ -104,7 +103,7 @@ public:
void forceNodeShutdown();
bool isShuttingDown() const { return _isShuttingDown; }
void octreePacketSent() { packetSent(*_octreePacket.get()); }
void octreePacketSent() { packetSent(*_octreePacket); }
void packetSent(const NLPacket& packet);
OCTREE_PACKET_SEQUENCE getSequenceNumber() const { return _sequenceNumber; }

View file

@ -11,13 +11,13 @@
#include "NLPacket.h"
int64_t NLPacket::localHeaderSize(PacketType::Value type) {
int64_t size = ((NON_SOURCED_PACKETS.contains(type)) ? 0 : NUM_BYTES_RFC4122_UUID) +
qint64 NLPacket::localHeaderSize(PacketType::Value type) {
qint64 size = ((NON_SOURCED_PACKETS.contains(type)) ? 0 : NUM_BYTES_RFC4122_UUID) +
((NON_VERIFIED_PACKETS.contains(type)) ? 0 : NUM_BYTES_RFC4122_UUID);
return size;
}
int64_t NLPacket::maxPayloadSize(PacketType::Value type) {
qint64 NLPacket::maxPayloadSize(PacketType::Value type) {
return Packet::maxPayloadSize(type) - localHeaderSize(type);
}
@ -29,11 +29,17 @@ qint64 NLPacket::localHeaderSize() const {
return localHeaderSize(_type);
}
std::unique_ptr<NLPacket> NLPacket::create(PacketType::Value type, int64_t size) {
if (size > maxPayloadSize(type)) {
return std::unique_ptr<NLPacket>();
std::unique_ptr<NLPacket> NLPacket::create(PacketType::Value type, qint64 size) {
auto maxPayload = maxPayloadSize(type);
if (size == -1) {
// default size of -1, means biggest packet possible
size = maxPayload;
}
// Fail with invalid size
Q_ASSERT(size >= 0 || size < maxPayload);
// allocate memory
return std::unique_ptr<NLPacket>(new NLPacket(type, size));
}
@ -41,7 +47,7 @@ std::unique_ptr<NLPacket> NLPacket::createCopy(const NLPacket& other) {
return std::unique_ptr<NLPacket>(new NLPacket(other));
}
NLPacket::NLPacket(PacketType::Value type, int64_t size) : Packet(type, localHeaderSize(type) + size) {
NLPacket::NLPacket(PacketType::Value type, qint64 size) : Packet(type, localHeaderSize(type) + size) {
}
NLPacket::NLPacket(const NLPacket& other) : Packet(other) {

View file

@ -17,18 +17,18 @@
class NLPacket : public Packet {
Q_OBJECT
public:
static std::unique_ptr<NLPacket> create(PacketType::Value type, int64_t size = -1);
static std::unique_ptr<NLPacket> create(PacketType::Value type, qint64 size = -1);
// Provided for convenience, try to limit use
static std::unique_ptr<NLPacket> createCopy(const NLPacket& other);
static int64_t localHeaderSize(PacketType::Value type);
static int64_t maxPayloadSize(PacketType::Value type);
static qint64 localHeaderSize(PacketType::Value type);
static qint64 maxPayloadSize(PacketType::Value type);
virtual qint64 totalHeadersSize() const; // Cumulated size of all the headers
virtual qint64 localHeaderSize() const; // Current level's header size
protected:
NLPacket(PacketType::Value type, int64_t size);
NLPacket(PacketType::Value type, qint64 size);
NLPacket(const NLPacket& other);
void setSourceUuid(QUuid sourceUuid);

View file

@ -29,10 +29,9 @@ std::unique_ptr<Packet> Packet::create(PacketType::Value type, qint64 size) {
// default size of -1, means biggest packet possible
size = maxPayload;
}
if (size <= 0 || size > maxPayload) {
// Invalid size, return null pointer
return std::unique_ptr<Packet>();
}
// Fail with invalid size
Q_ASSERT(size >= 0 || size < maxPayload);
// allocate memory
return std::unique_ptr<Packet>(new Packet(type, size));

View file

@ -23,7 +23,7 @@ class Packet : public QIODevice {
public:
using SequenceNumber = uint16_t;
static std::unique_ptr<Packet> create(PacketType::Value type, int64_t size = -1);
static std::unique_ptr<Packet> create(PacketType::Value type, qint64 size = -1);
// Provided for convenience, try to limit use
static std::unique_ptr<Packet> createCopy(const Packet& other);

View file

@ -675,7 +675,7 @@ void ScriptEngine::run() {
audioPacket->writePrimitive(sequence);
// send audio packet
nodeList->sendUnreliablePacket(audioPacket, node);
nodeList->sendUnreliablePacket(*audioPacket, node);
}
});
}

View file

@ -45,7 +45,7 @@ public:
void insert(const T& entry) {
// increment newest entry index cyclically
_newestEntryAtIndex = (_newestEntryAtIndex + 1) % size;
_newestEntryAtIndex = (_newestEntryAtIndex + 1) % _size;
// insert new entry
_buffer[_newestEntryAtIndex] = entry;
@ -57,7 +57,7 @@ public:
// std::unique_ptr need to be passed as an rvalue ref and moved into the vector
void insert(T&& entry) {
// increment newest entry index cyclically
_newestEntryAtIndex = (_newestEntryAtIndex == _size - 1) ? 0 : _newestEntryAtIndex + 1;
_newestEntryAtIndex = (_newestEntryAtIndex + 1) % _size;
// insert new entry
_buffer[_newestEntryAtIndex] = std::move(entry);