mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
resolve conflicts on merge with huffman/receive_packets
This commit is contained in:
commit
b115bd1a55
9 changed files with 22 additions and 20 deletions
|
@ -136,18 +136,19 @@ void OctreeInboundPacketProcessor::processPacket(QSharedPointer<NLPacket> packet
|
|||
if (debugProcessPacket) {
|
||||
qDebug() << " atByte (in payload)=" << packet->pos();
|
||||
qDebug() << " payload size=" << packet->getPayloadSize();
|
||||
if (!packet->bytesAvailable()) {
|
||||
|
||||
if (!packet->bytesLeftToRead()) {
|
||||
qDebug() << " ----- UNEXPECTED ---- got a packet without any edit details!!!! --------";
|
||||
}
|
||||
}
|
||||
|
||||
const unsigned char* editData = nullptr;
|
||||
|
||||
while (packet->bytesAvailable() > 0) {
|
||||
while (packet->bytesLeftToRead() > 0) {
|
||||
|
||||
editData = reinterpret_cast<const unsigned char*>(packet->getPayload() + packet->pos());
|
||||
|
||||
int maxSize = packet->bytesAvailable();
|
||||
int maxSize = packet->bytesLeftToRead();
|
||||
|
||||
if (debugProcessPacket) {
|
||||
qDebug() << " --- inside while loop ---";
|
||||
|
|
|
@ -2190,7 +2190,7 @@ void DomainServer::processPathQueryPacket(QSharedPointer<NLPacket> packet) {
|
|||
quint16 numPathBytes;
|
||||
packet->readPrimitive(&numPathBytes);
|
||||
|
||||
if (numPathBytes <= packet->bytesAvailable()) {
|
||||
if (numPathBytes <= packet->bytesLeftToRead()) {
|
||||
// the number of path bytes makes sense for the sent packet - pull out the path
|
||||
QString pathQuery = QString::fromUtf8(packet->getPayload() + packet->pos(), numPathBytes);
|
||||
|
||||
|
@ -2223,7 +2223,7 @@ void DomainServer::processPathQueryPacket(QSharedPointer<NLPacket> packet) {
|
|||
|
||||
// are we going to be able to fit this response viewpoint in a packet?
|
||||
if (numPathBytes + numViewpointBytes + sizeof(numViewpointBytes) + sizeof(numPathBytes)
|
||||
< (unsigned long) pathResponsePacket->bytesAvailable()) {
|
||||
< (unsigned long) pathResponsePacket->bytesLeftToRead()) {
|
||||
// append the number of bytes this path is
|
||||
pathResponsePacket->writePrimitive(numPathBytes);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void AvatarHashMap::processAvatarDataPacket(QSharedPointer<NLPacket> packet, Sha
|
|||
|
||||
// enumerate over all of the avatars in this packet
|
||||
// only add them if mixerWeakPointer points to something (meaning that mixer is still around)
|
||||
while (packet->bytesAvailable()) {
|
||||
while (packet->bytesLeftToRead()) {
|
||||
QUuid sessionUUID = QUuid::fromRfc4122(packet->read(NUM_BYTES_RFC4122_UUID));
|
||||
|
||||
if (sessionUUID != _lastOwnerSessionUUID) {
|
||||
|
@ -121,7 +121,7 @@ void AvatarHashMap::processAvatarBillboardPacket(QSharedPointer<NLPacket> packet
|
|||
avatar = addAvatar(sessionUUID, sendingNode);
|
||||
}
|
||||
|
||||
QByteArray billboard = packet->read(packet->bytesAvailable());
|
||||
QByteArray billboard = packet->read(packet->bytesLeftToRead());
|
||||
if (avatar->getBillboard() != billboard) {
|
||||
avatar->setBillboard(billboard);
|
||||
}
|
||||
|
|
|
@ -867,7 +867,7 @@ int EntityTree::processEraseMessage(NLPacket& packet, const SharedNodePointer& s
|
|||
|
||||
for (size_t i = 0; i < numberOfIDs; i++) {
|
||||
|
||||
if (NUM_BYTES_RFC4122_UUID > packet.bytesAvailable()) {
|
||||
if (NUM_BYTES_RFC4122_UUID > packet.bytesLeftToRead()) {
|
||||
qCDebug(entities) << "EntityTree::processEraseMessage().... bailing because not enough bytes in buffer";
|
||||
break; // bail to prevent buffer overflow
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ qint64 Packet::writeData(const char* data, qint64 maxSize) {
|
|||
|
||||
qint64 Packet::readData(char* dest, qint64 maxSize) {
|
||||
// we're either reading what is left from the current position or what was asked to be read
|
||||
qint64 numBytesToRead = std::min(bytesAvailable(), maxSize);
|
||||
qint64 numBytesToRead = std::min(bytesLeftToRead(), maxSize);
|
||||
|
||||
if (numBytesToRead > 0) {
|
||||
int currentPosition = pos();
|
||||
|
|
|
@ -55,8 +55,9 @@ public:
|
|||
void setPayloadSize(qint64 payloadSize);
|
||||
|
||||
qint64 getPayloadCapacity() const { return _payloadCapacity; }
|
||||
|
||||
qint64 bytesAvailableForWrite() const { return _payloadCapacity - _payloadSize; }
|
||||
|
||||
qint64 bytesLeftToRead() const { return _payloadCapacity - pos(); }
|
||||
qint64 bytesAvailableForWrite() const { return _payloadCapacity - pos(); }
|
||||
|
||||
HifiSockAddr& getSenderSockAddr() { return _senderSockAddr; }
|
||||
const HifiSockAddr& getSenderSockAddr() const { return _senderSockAddr; }
|
||||
|
|
|
@ -322,7 +322,7 @@ int JurisdictionMap::unpackFromPacket(NLPacket& packet) {
|
|||
int bytes = 0;
|
||||
packet.readPrimitive(&bytes);
|
||||
|
||||
if (bytes > 0 && bytes <= packet.bytesAvailable()) {
|
||||
if (bytes > 0 && bytes <= packet.bytesLeftToRead()) {
|
||||
_rootOctalCode = new unsigned char[bytes];
|
||||
packet.read(reinterpret_cast<char*>(_rootOctalCode), bytes);
|
||||
|
||||
|
@ -334,7 +334,7 @@ int JurisdictionMap::unpackFromPacket(NLPacket& packet) {
|
|||
int bytes = 0;
|
||||
packet.readPrimitive(&bytes);
|
||||
|
||||
if (bytes <= packet.bytesAvailable()) {
|
||||
if (bytes <= packet.bytesLeftToRead()) {
|
||||
unsigned char* endNodeCode = new unsigned char[bytes];
|
||||
packet.read(reinterpret_cast<char*>(endNodeCode), bytes);
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ void OctreeRenderer::processDatagram(NLPacket& packet, SharedNodePointer sourceN
|
|||
qCDebug(octree, "OctreeRenderer::processDatagram() ... Got Packet Section"
|
||||
" color:%s compressed:%s sequence: %u flight:%d usec size:%lld data:%lld",
|
||||
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
|
||||
sequence, flightTime, packet.getDataSize(), packet.bytesAvailable());
|
||||
sequence, flightTime, packet.getDataSize(), packet.bytesLeftToRead());
|
||||
}
|
||||
|
||||
_packetsInLastWindow++;
|
||||
|
@ -108,16 +108,16 @@ void OctreeRenderer::processDatagram(NLPacket& packet, SharedNodePointer sourceN
|
|||
|
||||
bool error = false;
|
||||
|
||||
while (packet.bytesAvailable() > 0 && !error) {
|
||||
while (packet.bytesLeftToRead() > 0 && !error) {
|
||||
if (packetIsCompressed) {
|
||||
if (packet.bytesAvailable() > (qint64) sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE)) {
|
||||
if (packet.bytesLeftToRead() > (qint64) sizeof(OCTREE_PACKET_INTERNAL_SECTION_SIZE)) {
|
||||
packet.readPrimitive(§ionLength);
|
||||
} else {
|
||||
sectionLength = 0;
|
||||
error = true;
|
||||
}
|
||||
} else {
|
||||
sectionLength = packet.bytesAvailable();
|
||||
sectionLength = packet.bytesLeftToRead();
|
||||
}
|
||||
|
||||
if (sectionLength) {
|
||||
|
@ -139,7 +139,7 @@ void OctreeRenderer::processDatagram(NLPacket& packet, SharedNodePointer sourceN
|
|||
" color:%s compressed:%s sequence: %u flight:%d usec size:%lld data:%lld"
|
||||
" subsection:%d sectionLength:%d uncompressed:%d",
|
||||
debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed),
|
||||
sequence, flightTime, packet.getDataSize(), packet.bytesAvailable(), subsection, sectionLength,
|
||||
sequence, flightTime, packet.getDataSize(), packet.bytesLeftToRead(), subsection, sectionLength,
|
||||
packetData.getUncompressedSize());
|
||||
}
|
||||
|
||||
|
|
|
@ -205,9 +205,9 @@ int Environment::processPacket(NLPacket& packet) {
|
|||
|
||||
EnvironmentData newData;
|
||||
|
||||
while (packet.bytesAvailable() > 0) {
|
||||
while (packet.bytesLeftToRead() > 0) {
|
||||
int dataLength = newData.parseData(reinterpret_cast<const unsigned char*>(packet.getPayload() + packet.pos()),
|
||||
packet.bytesAvailable());
|
||||
packet.bytesLeftToRead());
|
||||
packet.seek(packet.pos() + dataLength);
|
||||
|
||||
// update the mapping by address/ID
|
||||
|
|
Loading…
Reference in a new issue