fixed bug in processing of entity erase messages

This commit is contained in:
ZappoMan 2014-08-27 14:21:06 -07:00
parent 5c2b674a0d
commit ed6363ca02
4 changed files with 10 additions and 6 deletions

View file

@ -75,7 +75,6 @@ void DatagramProcessor::processDatagrams() {
case PacketTypeEnvironmentData: { case PacketTypeEnvironmentData: {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
"Application::networkReceive()... _octreeProcessor.queueReceivedPacket()"); "Application::networkReceive()... _octreeProcessor.queueReceivedPacket()");
bool wantExtraDebugging = application->getLogger()->extraDebugging(); bool wantExtraDebugging = application->getLogger()->extraDebugging();
if (wantExtraDebugging && packetTypeForPacket(incomingPacket) == PacketTypeVoxelData) { if (wantExtraDebugging && packetTypeForPacket(incomingPacket) == PacketTypeVoxelData) {
int numBytesPacketHeader = numBytesForPacketHeader(incomingPacket); int numBytesPacketHeader = numBytesForPacketHeader(incomingPacket);

View file

@ -46,7 +46,6 @@ void DeleteEntityOperator::addEntityIDToDeleteList(const EntityItemID& searchEnt
details.cube = details.containingElement->getAACube(); details.cube = details.containingElement->getAACube();
_entitiesToDelete << details; _entitiesToDelete << details;
_lookingCount++; _lookingCount++;
_tree->trackDeletedEntity(searchEntityID); _tree->trackDeletedEntity(searchEntityID);
} }
} }

View file

@ -726,7 +726,6 @@ bool EntityTree::hasEntitiesDeletedSince(quint64 sinceTime) {
// sinceTime is an in/out parameter - it will be side effected with the last time sent out // sinceTime is an in/out parameter - it will be side effected with the last time sent out
bool EntityTree::encodeEntitiesDeletedSince(OCTREE_PACKET_SEQUENCE sequenceNumber, quint64& sinceTime, unsigned char* outputBuffer, bool EntityTree::encodeEntitiesDeletedSince(OCTREE_PACKET_SEQUENCE sequenceNumber, quint64& sinceTime, unsigned char* outputBuffer,
size_t maxLength, size_t& outputLength) { size_t maxLength, size_t& outputLength) {
bool hasMoreToSend = true; bool hasMoreToSend = true;
unsigned char* copyAt = outputBuffer; unsigned char* copyAt = outputBuffer;
@ -763,6 +762,7 @@ bool EntityTree::encodeEntitiesDeletedSince(OCTREE_PACKET_SEQUENCE sequenceNumbe
// we keep a multi map of entity IDs to timestamps, we only want to include the entity IDs that have been // we keep a multi map of entity IDs to timestamps, we only want to include the entity IDs that have been
// deleted since we last sent to this node // deleted since we last sent to this node
_recentlyDeletedEntitiesLock.lockForRead(); _recentlyDeletedEntitiesLock.lockForRead();
QMultiMap<quint64, QUuid>::const_iterator iterator = _recentlyDeletedEntityItemIDs.constBegin(); QMultiMap<quint64, QUuid>::const_iterator iterator = _recentlyDeletedEntityItemIDs.constBegin();
while (iterator != _recentlyDeletedEntityItemIDs.constEnd()) { while (iterator != _recentlyDeletedEntityItemIDs.constEnd()) {
QList<QUuid> values = _recentlyDeletedEntityItemIDs.values(iterator.key()); QList<QUuid> values = _recentlyDeletedEntityItemIDs.values(iterator.key());
@ -771,7 +771,6 @@ bool EntityTree::encodeEntitiesDeletedSince(OCTREE_PACKET_SEQUENCE sequenceNumbe
// if the timestamp is more recent then out last sent time, include it // if the timestamp is more recent then out last sent time, include it
if (iterator.key() > sinceTime) { if (iterator.key() > sinceTime) {
QUuid entityID = values.at(valueItem); QUuid entityID = values.at(valueItem);
QByteArray encodedEntityID = entityID.toRfc4122(); QByteArray encodedEntityID = entityID.toRfc4122();
memcpy(copyAt, encodedEntityID.constData(), NUM_BYTES_RFC4122_UUID); memcpy(copyAt, encodedEntityID.constData(), NUM_BYTES_RFC4122_UUID);
copyAt += NUM_BYTES_RFC4122_UUID; copyAt += NUM_BYTES_RFC4122_UUID;
@ -803,6 +802,7 @@ bool EntityTree::encodeEntitiesDeletedSince(OCTREE_PACKET_SEQUENCE sequenceNumbe
// replace the correct count for ids included // replace the correct count for ids included
memcpy(numberOfIDsAt, &numberOfIds, sizeof(numberOfIds)); memcpy(numberOfIDsAt, &numberOfIds, sizeof(numberOfIds));
return hasMoreToSend; return hasMoreToSend;
} }
@ -836,7 +836,6 @@ void EntityTree::forgetEntitiesDeletedBefore(quint64 sinceTime) {
// TODO: consider consolidating processEraseMessageDetails() and processEraseMessage() // TODO: consider consolidating processEraseMessageDetails() and processEraseMessage()
int EntityTree::processEraseMessage(const QByteArray& dataByteArray, const SharedNodePointer& sourceNode) { int EntityTree::processEraseMessage(const QByteArray& dataByteArray, const SharedNodePointer& sourceNode) {
const bool wantDebug = false; const bool wantDebug = false;
if (wantDebug) { if (wantDebug) {
qDebug() << "EntityTree::processEraseMessage()..."; qDebug() << "EntityTree::processEraseMessage()...";
} }
@ -850,8 +849,13 @@ int EntityTree::processEraseMessage(const QByteArray& dataByteArray, const Share
dataAt += numBytesPacketHeader; dataAt += numBytesPacketHeader;
dataAt += sizeof(OCTREE_PACKET_FLAGS); dataAt += sizeof(OCTREE_PACKET_FLAGS);
processedBytes += sizeof(OCTREE_PACKET_FLAGS);
dataAt += sizeof(OCTREE_PACKET_SEQUENCE); dataAt += sizeof(OCTREE_PACKET_SEQUENCE);
processedBytes += sizeof(OCTREE_PACKET_SEQUENCE);
dataAt += sizeof(OCTREE_PACKET_SENT_TIME); dataAt += sizeof(OCTREE_PACKET_SENT_TIME);
processedBytes += sizeof(OCTREE_PACKET_SENT_TIME);
uint16_t numberOfIds = 0; // placeholder for now uint16_t numberOfIds = 0; // placeholder for now
memcpy(&numberOfIds, dataAt, sizeof(numberOfIds)); memcpy(&numberOfIds, dataAt, sizeof(numberOfIds));

View file

@ -8,12 +8,14 @@
cases: cases:
PASSED -- 1) test UI delete entity (on client) PASSED -- 1) test UI delete entity (on client)
PASSED -- 2) test UI delete entity (on server) PASSED -- 2) test UI delete entity (on server)
PASSED --- 7) test UI delete on other client
3) test client shutdown 3) test client shutdown
4) test server shutdown (on server) - aka domain restart 4) test server shutdown (on server) - aka domain restart
5) test server shutdown (on client) 5) test server shutdown (on client)
6) test change domains 6) test change domains
7) test UI delete on other client
9) EntityTreeRenderer::clearModelsCache() 9) EntityTreeRenderer::clearModelsCache()