History

Workaround for too large properties already on a server

Karol Suprynowicz committed 10 months ago

Commit e583e111 parent f25e49c1 file · +12 −0Browse files

Showing the changes to assignment-client/src/entities/EntityTreeSendThread.cpp (1 of 1 file). Show all

Unified · Split

assignment-client/src/entities/EntityTreeSendThread.cpp+12−0
@@ -362,9 +362,11 @@ bool EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload(EncodeBitstream · 361 unmodified lines
362362 nodeData->stats.encodeStarted();
363363 auto entityNode = _node.toStrongRef();
364364 auto entityNodeData = static_cast<EntityNodeData*>(entityNode->getLinkedData());
365+ EntityItemPointer lastEntity;
365366 while(!_sendQueue.empty()) {
366367 PrioritizedEntity queuedItem = _sendQueue.top();
367368 EntityItemPointer entity = queuedItem.getEntity();
369+ lastEntity = entity;
368370 if (entity) {
369371 const QUuid& entityID = entity->getID();
370372 // Only send entities that match the jsonFilters, but keep track of everything we've tried to send so we don't try to send it again;
@@ -407,6 +409,16 @@ bool EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload(EncodeBitstream · 36 unmodified lines
407409 _extraEncodeData->entities.clear();
408410 }
409411
412+ // This is a workaround for case where entity property is too big to be transmitted at all.
413+ // The issue only happens when maximum packet size is lowered after the server was already created, since normally
414+ // such properties will not be possible to be created in the first place.
415+ // TODO: This can be safely removed once multi-packet entity properties get implemented.
416+ if (_numEntities == 0 && params.stopReason == EncodeBitstreamParams::DIDNT_FIT) {
417+ qDebug() << "EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload: One of the entities has a property "
418+ " that is too large to be transmitted. Entity UUID: "
419+ << lastEntity->getID() << " type: " << lastEntity->getType() << " name: " << lastEntity->getName();
420+ params.stopReason = EncodeBitstreamParams::FINISHED;
421+ }
410422 if (_numEntities == 0) {
411423 _packetData.discardLevel(entitiesLevel);
412424 OctreeServer::trackEncodeTime((float)(usecTimestampNow() - encodeStart));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t