From 557ee458ecf01cbfcd44a8d3d3574e065c51bcc6 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 14 Nov 2017 17:06:46 -0800 Subject: [PATCH] wait for node active socket before constructing packets --- assignment-client/src/octree/OctreeSendThread.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/assignment-client/src/octree/OctreeSendThread.cpp b/assignment-client/src/octree/OctreeSendThread.cpp index 024071db0a..3ae653307f 100644 --- a/assignment-client/src/octree/OctreeSendThread.cpp +++ b/assignment-client/src/octree/OctreeSendThread.cpp @@ -82,9 +82,12 @@ bool OctreeSendThread::process() { if (auto node = _node.lock()) { OctreeQueryNode* nodeData = static_cast(node->getLinkedData()); - // If we don't have the OctreeQueryNode or it's uninitialized because we haven't received - // a query yet from the client then we can't send an entity data packet - if (nodeData && nodeData->hasReceivedFirstQuery() && !nodeData->isShuttingDown()) { + // If we don't have the OctreeQueryNode at all + // or it's uninitialized because we haven't received a query yet from the client + // or we don't know where we should send packets for this node + // or we're shutting down + // then we can't send an entity data packet + if (nodeData && nodeData->hasReceivedFirstQuery() && node->getActiveSocket() && !nodeData->isShuttingDown()) { bool viewFrustumChanged = nodeData->updateCurrentViewFrustum(); packetDistributor(node, nodeData, viewFrustumChanged); }