From 6e9e21051dd914cc5b885bf2518d97a467475c4b Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 22 Jan 2014 14:05:31 -0800 Subject: [PATCH 1/6] first cut at move JurisdicionListener and JuridictionSender into non-mulitply derived classes --- animation-server/src/AnimationServer.cpp | 1 + assignment-client/src/Agent.cpp | 4 ++++ interface/src/VoxelHideShowThread.h | 2 +- .../octree-server/src/OctreeSendThread.h | 2 +- libraries/octree/src/JurisdictionListener.cpp | 23 ++++++++++++------- libraries/octree/src/JurisdictionListener.h | 4 +++- libraries/octree/src/JurisdictionMap.cpp | 23 +++++++++++++------ libraries/octree/src/JurisdictionSender.cpp | 12 ++++++---- libraries/octree/src/JurisdictionSender.h | 4 +++- .../octree/src/OctreeScriptingInterface.cpp | 4 ++-- .../src/ParticlesScriptingInterface.h | 2 +- .../voxels/src/VoxelsScriptingInterface.h | 2 +- 12 files changed, 55 insertions(+), 28 deletions(-) diff --git a/animation-server/src/AnimationServer.cpp b/animation-server/src/AnimationServer.cpp index f684a6e672..50529fbdff 100644 --- a/animation-server/src/AnimationServer.cpp +++ b/animation-server/src/AnimationServer.cpp @@ -838,6 +838,7 @@ void AnimationServer::readPendingDatagrams() { int headerBytes = numBytesForPacketHeader(packetData); // PACKET_TYPE_JURISDICTION, first byte is the node type... if (packetData[headerBytes] == NODE_TYPE_VOXEL_SERVER && ::jurisdictionListener) { + //qDebug() << "calling ::jurisdictionListener->queueReceivedPacket(nodeSockAddr, packetData, receivedBytes);"; ::jurisdictionListener->queueReceivedPacket(nodeSockAddr, packetData, receivedBytes); } } diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 913f22be18..6f2f61f4f9 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -28,8 +28,12 @@ Agent::Agent(const unsigned char* dataBuffer, int numBytes) : } void Agent::processDatagram(const QByteArray& dataByteArray, const HifiSockAddr& senderSockAddr) { +qDebug() << "Agent::processDatagram()"; if (dataByteArray[0] == PACKET_TYPE_JURISDICTION) { int headerBytes = numBytesForPacketHeader((const unsigned char*) dataByteArray.constData()); + +qDebug() << "Agent::processDatagram() PACKET_TYPE_JURISDICTION... dataByteArray[headerBytes]=" << (dataByteArray[headerBytes]); + // PACKET_TYPE_JURISDICTION, first byte is the node type... switch (dataByteArray[headerBytes]) { case NODE_TYPE_VOXEL_SERVER: diff --git a/interface/src/VoxelHideShowThread.h b/interface/src/VoxelHideShowThread.h index 22df6c299c..2925888022 100644 --- a/interface/src/VoxelHideShowThread.h +++ b/interface/src/VoxelHideShowThread.h @@ -15,7 +15,7 @@ #include "VoxelSystem.h" /// Generalized threaded processor for handling received inbound packets. -class VoxelHideShowThread : public virtual GenericThread { +class VoxelHideShowThread : public GenericThread { public: VoxelHideShowThread(VoxelSystem* theSystem); diff --git a/libraries/octree-server/src/OctreeSendThread.h b/libraries/octree-server/src/OctreeSendThread.h index a2de8fcb5d..c0936371f2 100644 --- a/libraries/octree-server/src/OctreeSendThread.h +++ b/libraries/octree-server/src/OctreeSendThread.h @@ -17,7 +17,7 @@ #include "OctreeServer.h" /// Threaded processor for sending voxel packets to a single client -class OctreeSendThread : public virtual GenericThread { +class OctreeSendThread : public GenericThread { public: OctreeSendThread(const QUuid& nodeUUID, OctreeServer* myServer); diff --git a/libraries/octree/src/JurisdictionListener.cpp b/libraries/octree/src/JurisdictionListener.cpp index d8919ac48e..e885c35a76 100644 --- a/libraries/octree/src/JurisdictionListener.cpp +++ b/libraries/octree/src/JurisdictionListener.cpp @@ -16,13 +16,14 @@ #include "JurisdictionListener.h" JurisdictionListener::JurisdictionListener(NODE_TYPE type, PacketSenderNotify* notify) : - PacketSender(notify, JurisdictionListener::DEFAULT_PACKETS_PER_SECOND) + _packetSender(notify, JurisdictionListener::DEFAULT_PACKETS_PER_SECOND) { _nodeType = type; ReceivedPacketProcessor::_dontSleep = true; // we handle sleeping so this class doesn't need to // connect(nodeList, &NodeList::nodeKilled, this, &JurisdictionListener::nodeKilled); -// qDebug("JurisdictionListener::JurisdictionListener(NODE_TYPE type=%c)\n", type); + + qDebug("JurisdictionListener::JurisdictionListener(NODE_TYPE type=%c)", type); } void JurisdictionListener::nodeKilled(SharedNodePointer node) { @@ -32,7 +33,7 @@ void JurisdictionListener::nodeKilled(SharedNodePointer node) { } bool JurisdictionListener::queueJurisdictionRequest() { - //qDebug() << "JurisdictionListener::queueJurisdictionRequest()\n"; + //qDebug() << "JurisdictionListener::queueJurisdictionRequest()"; static unsigned char buffer[MAX_PACKET_SIZE]; unsigned char* bufferOut = &buffer[0]; @@ -45,15 +46,15 @@ bool JurisdictionListener::queueJurisdictionRequest() { if (nodeList->getNodeActiveSocketOrPing(node.data()) && node->getType() == getNodeType()) { const HifiSockAddr* nodeAddress = node->getActiveSocket(); - PacketSender::queuePacketForSending(*nodeAddress, bufferOut, sizeOut); + _packetSender.queuePacketForSending(*nodeAddress, bufferOut, sizeOut); nodeCount++; } } if (nodeCount > 0){ - setPacketsPerSecond(nodeCount); + _packetSender.setPacketsPerSecond(nodeCount); } else { - setPacketsPerSecond(NO_SERVER_CHECK_RATE); + _packetSender.setPacketsPerSecond(NO_SERVER_CHECK_RATE); } // keep going if still running @@ -61,6 +62,7 @@ bool JurisdictionListener::queueJurisdictionRequest() { } void JurisdictionListener::processPacket(const HifiSockAddr& senderAddress, unsigned char* packetData, ssize_t packetLength) { + qDebug() << "JurisdictionListener::processPacket()"; if (packetData[0] == PACKET_TYPE_JURISDICTION) { SharedNodePointer node = NodeList::getInstance()->nodeWithAddress(senderAddress); if (node) { @@ -73,12 +75,17 @@ void JurisdictionListener::processPacket(const HifiSockAddr& senderAddress, unsi } bool JurisdictionListener::process() { + //qDebug() << "JurisdictionListener::process()"; bool continueProcessing = isStillRunning(); // If we're still running, and we don't have any requests waiting to be sent, then queue our jurisdiction requests - if (continueProcessing && !hasPacketsToSend()) { + if (continueProcessing && !_packetSender.hasPacketsToSend()) { queueJurisdictionRequest(); - continueProcessing = PacketSender::process(); + } + + if (continueProcessing) { + //qDebug() << "JurisdictionListener::process() calling _packetSender.process()"; + continueProcessing = _packetSender.process(); } if (continueProcessing) { // NOTE: This will sleep if there are no pending packets to process diff --git a/libraries/octree/src/JurisdictionListener.h b/libraries/octree/src/JurisdictionListener.h index 393ca80420..c112f43b52 100644 --- a/libraries/octree/src/JurisdictionListener.h +++ b/libraries/octree/src/JurisdictionListener.h @@ -22,7 +22,7 @@ /// the PACKET_TYPE_JURISDICTION packets it receives in order to maintain an accurate state of all jurisidictions /// within the domain. As with other ReceivedPacketProcessor classes the user is responsible for reading inbound packets /// and adding them to the processing queue by calling queueReceivedPacket() -class JurisdictionListener : public PacketSender, public ReceivedPacketProcessor { +class JurisdictionListener : public ReceivedPacketProcessor { public: static const int DEFAULT_PACKETS_PER_SECOND = 1; static const int NO_SERVER_CHECK_RATE = 60; // if no servers yet detected, keep checking at 60fps @@ -55,5 +55,7 @@ private: NODE_TYPE _nodeType; bool queueJurisdictionRequest(); + + PacketSender _packetSender; }; #endif // __shared__JurisdictionListener__ diff --git a/libraries/octree/src/JurisdictionMap.cpp b/libraries/octree/src/JurisdictionMap.cpp index 53cc955553..aeec45be98 100644 --- a/libraries/octree/src/JurisdictionMap.cpp +++ b/libraries/octree/src/JurisdictionMap.cpp @@ -331,16 +331,20 @@ int JurisdictionMap::unpackFromMessage(unsigned char* sourceBuffer, int availabl // increment to push past the packet header int numBytesPacketHeader = numBytesForPacketHeader(sourceBuffer); sourceBuffer += numBytesPacketHeader; + int remaingingBytes = availableBytes - numBytesPacketHeader; // read the root jurisdiction int bytes = 0; memcpy(&bytes, sourceBuffer, sizeof(bytes)); sourceBuffer += sizeof(bytes); + remaingingBytes -= sizeof(bytes); - if (bytes > 0) { + if (bytes > 0 && bytes <= remaingingBytes) { _rootOctalCode = new unsigned char[bytes]; memcpy(_rootOctalCode, sourceBuffer, bytes); sourceBuffer += bytes; + remaingingBytes -= bytes; + // if and only if there's a root jurisdiction, also include the end nodes int endNodeCount = 0; memcpy(&endNodeCount, sourceBuffer, sizeof(endNodeCount)); @@ -349,13 +353,18 @@ int JurisdictionMap::unpackFromMessage(unsigned char* sourceBuffer, int availabl int bytes = 0; memcpy(&bytes, sourceBuffer, sizeof(bytes)); sourceBuffer += sizeof(bytes); - unsigned char* endNodeCode = new unsigned char[bytes]; - memcpy(endNodeCode, sourceBuffer, bytes); - sourceBuffer += bytes; + remaingingBytes -= sizeof(bytes); - // if the endNodeCode was 0 length then don't add it - if (bytes > 0) { - _endNodes.push_back(endNodeCode); + if (bytes <= remaingingBytes) { + unsigned char* endNodeCode = new unsigned char[bytes]; + memcpy(endNodeCode, sourceBuffer, bytes); + sourceBuffer += bytes; + remaingingBytes -= bytes; + + // if the endNodeCode was 0 length then don't add it + if (bytes > 0) { + _endNodes.push_back(endNodeCode); + } } } } diff --git a/libraries/octree/src/JurisdictionSender.cpp b/libraries/octree/src/JurisdictionSender.cpp index ab31f9356b..2869acfd60 100644 --- a/libraries/octree/src/JurisdictionSender.cpp +++ b/libraries/octree/src/JurisdictionSender.cpp @@ -17,9 +17,9 @@ JurisdictionSender::JurisdictionSender(JurisdictionMap* map, NODE_TYPE type, PacketSenderNotify* notify) : - PacketSender(notify, JurisdictionSender::DEFAULT_PACKETS_PER_SECOND), ReceivedPacketProcessor(), - _jurisdictionMap(map) + _jurisdictionMap(map), + _packetSender(notify, JurisdictionSender::DEFAULT_PACKETS_PER_SECOND) { _nodeType = type; } @@ -30,9 +30,11 @@ JurisdictionSender::~JurisdictionSender() { void JurisdictionSender::processPacket(const HifiSockAddr& senderAddress, unsigned char* packetData, ssize_t packetLength) { if (packetData[0] == PACKET_TYPE_JURISDICTION_REQUEST) { +qDebug() << "JurisdictionSender::processPacket()... got PACKET_TYPE_JURISDICTION_REQUEST"; SharedNodePointer node = NodeList::getInstance()->nodeWithAddress(senderAddress); if (node) { QUuid nodeUUID = node->getUUID(); +qDebug() << "JurisdictionSender::processPacket()... nodeUUID=" << nodeUUID; lockRequestingNodes(); _nodesRequestingJurisdictions.push(nodeUUID); unlockRequestingNodes(); @@ -66,16 +68,16 @@ bool JurisdictionSender::process() { if (node->getActiveSocket() != NULL) { const HifiSockAddr* nodeAddress = node->getActiveSocket(); - queuePacketForSending(*nodeAddress, bufferOut, sizeOut); + _packetSender.queuePacketForSending(*nodeAddress, bufferOut, sizeOut); nodeCount++; } } unlockRequestingNodes(); // set our packets per second to be the number of nodes - setPacketsPerSecond(nodeCount); + _packetSender.setPacketsPerSecond(nodeCount); - continueProcessing = PacketSender::process(); + continueProcessing = _packetSender.process(); } return continueProcessing; } diff --git a/libraries/octree/src/JurisdictionSender.h b/libraries/octree/src/JurisdictionSender.h index 441bb5ee1e..287a5dbf61 100644 --- a/libraries/octree/src/JurisdictionSender.h +++ b/libraries/octree/src/JurisdictionSender.h @@ -21,7 +21,7 @@ /// Will process PACKET_TYPE_JURISDICTION_REQUEST packets and send out PACKET_TYPE_JURISDICTION packets /// to requesting parties. As with other ReceivedPacketProcessor classes the user is responsible for reading inbound packets /// and adding them to the processing queue by calling queueReceivedPacket() -class JurisdictionSender : public PacketSender, public ReceivedPacketProcessor { +class JurisdictionSender : public ReceivedPacketProcessor { Q_OBJECT public: static const int DEFAULT_PACKETS_PER_SECOND = 1; @@ -51,5 +51,7 @@ private: JurisdictionMap* _jurisdictionMap; std::queue _nodesRequestingJurisdictions; NODE_TYPE _nodeType; + + PacketSender _packetSender; }; #endif // __shared__JurisdictionSender__ diff --git a/libraries/octree/src/OctreeScriptingInterface.cpp b/libraries/octree/src/OctreeScriptingInterface.cpp index d72f2e7443..f054f8c450 100644 --- a/libraries/octree/src/OctreeScriptingInterface.cpp +++ b/libraries/octree/src/OctreeScriptingInterface.cpp @@ -46,7 +46,7 @@ void OctreeScriptingInterface::init() { } else { _managedJurisdictionListener = true; _jurisdictionListener = new JurisdictionListener(getServerNodeType()); - //printf("OctreeScriptingInterface::init() _managedJurisdictionListener=true, creating _jurisdictionListener=%p\n", _jurisdictionListener); + qDebug("OctreeScriptingInterface::init() _managedJurisdictionListener=true, creating _jurisdictionListener=%p", _jurisdictionListener); _jurisdictionListener->initialize(true); } @@ -55,7 +55,7 @@ void OctreeScriptingInterface::init() { } else { _managedPacketSender = true; _packetSender = createPacketSender(); - //printf("OctreeScriptingInterface::init() _managedPacketSender=true, creating _packetSender=%p\n", _packetSender); + printf("OctreeScriptingInterface::init() _managedPacketSender=true, creating _packetSender=%p", _packetSender); _packetSender->setServerJurisdictions(_jurisdictionListener->getJurisdictions()); } } diff --git a/libraries/particles/src/ParticlesScriptingInterface.h b/libraries/particles/src/ParticlesScriptingInterface.h index 265f5a7ca4..3fbcc76c03 100644 --- a/libraries/particles/src/ParticlesScriptingInterface.h +++ b/libraries/particles/src/ParticlesScriptingInterface.h @@ -11,7 +11,7 @@ #include -#include +//#include #include #include "ParticleEditPacketSender.h" diff --git a/libraries/voxels/src/VoxelsScriptingInterface.h b/libraries/voxels/src/VoxelsScriptingInterface.h index c725b93493..200f606730 100644 --- a/libraries/voxels/src/VoxelsScriptingInterface.h +++ b/libraries/voxels/src/VoxelsScriptingInterface.h @@ -11,7 +11,7 @@ #include -#include +//#include #include #include "VoxelEditPacketSender.h" From 39f7111b2d0ab92a2d7ecee53cacdbdd17f75f9a Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 22 Jan 2014 14:21:03 -0800 Subject: [PATCH 2/6] remove public virtual from PacketSender and RecievedPacketProcessor --- libraries/shared/src/PacketSender.h | 2 +- libraries/shared/src/ReceivedPacketProcessor.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/shared/src/PacketSender.h b/libraries/shared/src/PacketSender.h index 9005a2b254..7a2c6e6d2a 100644 --- a/libraries/shared/src/PacketSender.h +++ b/libraries/shared/src/PacketSender.h @@ -23,7 +23,7 @@ public: /// Generalized threaded processor for queueing and sending of outbound packets. -class PacketSender : public virtual GenericThread { +class PacketSender : public GenericThread { public: static const uint64_t USECS_PER_SECOND; diff --git a/libraries/shared/src/ReceivedPacketProcessor.h b/libraries/shared/src/ReceivedPacketProcessor.h index 621204025e..567434a49e 100644 --- a/libraries/shared/src/ReceivedPacketProcessor.h +++ b/libraries/shared/src/ReceivedPacketProcessor.h @@ -15,7 +15,7 @@ #include "NetworkPacket.h" /// Generalized threaded processor for handling received inbound packets. -class ReceivedPacketProcessor : public virtual GenericThread { +class ReceivedPacketProcessor : public GenericThread { public: ReceivedPacketProcessor(); From 132b043d68abfbe2b98659675e63e1e08ee2ff8d Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 22 Jan 2014 14:26:03 -0800 Subject: [PATCH 3/6] removed debug code --- assignment-client/src/Agent.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 6f2f61f4f9..913f22be18 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -28,12 +28,8 @@ Agent::Agent(const unsigned char* dataBuffer, int numBytes) : } void Agent::processDatagram(const QByteArray& dataByteArray, const HifiSockAddr& senderSockAddr) { -qDebug() << "Agent::processDatagram()"; if (dataByteArray[0] == PACKET_TYPE_JURISDICTION) { int headerBytes = numBytesForPacketHeader((const unsigned char*) dataByteArray.constData()); - -qDebug() << "Agent::processDatagram() PACKET_TYPE_JURISDICTION... dataByteArray[headerBytes]=" << (dataByteArray[headerBytes]); - // PACKET_TYPE_JURISDICTION, first byte is the node type... switch (dataByteArray[headerBytes]) { case NODE_TYPE_VOXEL_SERVER: From ef2d0e97da4fa2ef8c4fa26e7142a73e1ec0f7f7 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 22 Jan 2014 14:26:57 -0800 Subject: [PATCH 4/6] removed some debug code --- animation-server/src/AnimationServer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/animation-server/src/AnimationServer.cpp b/animation-server/src/AnimationServer.cpp index 50529fbdff..f684a6e672 100644 --- a/animation-server/src/AnimationServer.cpp +++ b/animation-server/src/AnimationServer.cpp @@ -838,7 +838,6 @@ void AnimationServer::readPendingDatagrams() { int headerBytes = numBytesForPacketHeader(packetData); // PACKET_TYPE_JURISDICTION, first byte is the node type... if (packetData[headerBytes] == NODE_TYPE_VOXEL_SERVER && ::jurisdictionListener) { - //qDebug() << "calling ::jurisdictionListener->queueReceivedPacket(nodeSockAddr, packetData, receivedBytes);"; ::jurisdictionListener->queueReceivedPacket(nodeSockAddr, packetData, receivedBytes); } } From b9ccd28428af3eb4c61a2581c83a3f3bfbc44752 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 22 Jan 2014 14:35:38 -0800 Subject: [PATCH 5/6] removed some debug code --- libraries/octree/src/JurisdictionListener.cpp | 7 +++---- libraries/octree/src/JurisdictionSender.cpp | 2 -- libraries/octree/src/OctreeScriptingInterface.cpp | 4 ++-- libraries/particles/src/ParticlesScriptingInterface.h | 1 - libraries/voxels/src/VoxelsScriptingInterface.h | 1 - 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/libraries/octree/src/JurisdictionListener.cpp b/libraries/octree/src/JurisdictionListener.cpp index e885c35a76..6ed039f0bd 100644 --- a/libraries/octree/src/JurisdictionListener.cpp +++ b/libraries/octree/src/JurisdictionListener.cpp @@ -21,9 +21,8 @@ JurisdictionListener::JurisdictionListener(NODE_TYPE type, PacketSenderNotify* n _nodeType = type; ReceivedPacketProcessor::_dontSleep = true; // we handle sleeping so this class doesn't need to -// connect(nodeList, &NodeList::nodeKilled, this, &JurisdictionListener::nodeKilled); - - qDebug("JurisdictionListener::JurisdictionListener(NODE_TYPE type=%c)", type); + connect(NodeList::getInstance(), &NodeList::nodeKilled, this, &JurisdictionListener::nodeKilled); + //qDebug("JurisdictionListener::JurisdictionListener(NODE_TYPE type=%c)", type); } void JurisdictionListener::nodeKilled(SharedNodePointer node) { @@ -62,7 +61,7 @@ bool JurisdictionListener::queueJurisdictionRequest() { } void JurisdictionListener::processPacket(const HifiSockAddr& senderAddress, unsigned char* packetData, ssize_t packetLength) { - qDebug() << "JurisdictionListener::processPacket()"; + //qDebug() << "JurisdictionListener::processPacket()"; if (packetData[0] == PACKET_TYPE_JURISDICTION) { SharedNodePointer node = NodeList::getInstance()->nodeWithAddress(senderAddress); if (node) { diff --git a/libraries/octree/src/JurisdictionSender.cpp b/libraries/octree/src/JurisdictionSender.cpp index 2869acfd60..521dbdb7e4 100644 --- a/libraries/octree/src/JurisdictionSender.cpp +++ b/libraries/octree/src/JurisdictionSender.cpp @@ -30,11 +30,9 @@ JurisdictionSender::~JurisdictionSender() { void JurisdictionSender::processPacket(const HifiSockAddr& senderAddress, unsigned char* packetData, ssize_t packetLength) { if (packetData[0] == PACKET_TYPE_JURISDICTION_REQUEST) { -qDebug() << "JurisdictionSender::processPacket()... got PACKET_TYPE_JURISDICTION_REQUEST"; SharedNodePointer node = NodeList::getInstance()->nodeWithAddress(senderAddress); if (node) { QUuid nodeUUID = node->getUUID(); -qDebug() << "JurisdictionSender::processPacket()... nodeUUID=" << nodeUUID; lockRequestingNodes(); _nodesRequestingJurisdictions.push(nodeUUID); unlockRequestingNodes(); diff --git a/libraries/octree/src/OctreeScriptingInterface.cpp b/libraries/octree/src/OctreeScriptingInterface.cpp index f054f8c450..7355b8e2de 100644 --- a/libraries/octree/src/OctreeScriptingInterface.cpp +++ b/libraries/octree/src/OctreeScriptingInterface.cpp @@ -46,7 +46,7 @@ void OctreeScriptingInterface::init() { } else { _managedJurisdictionListener = true; _jurisdictionListener = new JurisdictionListener(getServerNodeType()); - qDebug("OctreeScriptingInterface::init() _managedJurisdictionListener=true, creating _jurisdictionListener=%p", _jurisdictionListener); + //qDebug("OctreeScriptingInterface::init() _managedJurisdictionListener=true, creating _jurisdictionListener=%p", _jurisdictionListener); _jurisdictionListener->initialize(true); } @@ -55,7 +55,7 @@ void OctreeScriptingInterface::init() { } else { _managedPacketSender = true; _packetSender = createPacketSender(); - printf("OctreeScriptingInterface::init() _managedPacketSender=true, creating _packetSender=%p", _packetSender); + //qDebug("OctreeScriptingInterface::init() _managedPacketSender=true, creating _packetSender=%p", _packetSender); _packetSender->setServerJurisdictions(_jurisdictionListener->getJurisdictions()); } } diff --git a/libraries/particles/src/ParticlesScriptingInterface.h b/libraries/particles/src/ParticlesScriptingInterface.h index e284ccfa72..d61f8289f4 100644 --- a/libraries/particles/src/ParticlesScriptingInterface.h +++ b/libraries/particles/src/ParticlesScriptingInterface.h @@ -11,7 +11,6 @@ #include -//#include #include #include "ParticleEditPacketSender.h" diff --git a/libraries/voxels/src/VoxelsScriptingInterface.h b/libraries/voxels/src/VoxelsScriptingInterface.h index b4b0a933a2..a1f52fc1c3 100644 --- a/libraries/voxels/src/VoxelsScriptingInterface.h +++ b/libraries/voxels/src/VoxelsScriptingInterface.h @@ -11,7 +11,6 @@ #include -//#include #include #include "VoxelConstants.h" From e0f68bedc1daa64674110e1513baf6c0b60e1e1c Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 22 Jan 2014 15:25:05 -0800 Subject: [PATCH 6/6] fixed type --- libraries/octree/src/JurisdictionMap.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/octree/src/JurisdictionMap.cpp b/libraries/octree/src/JurisdictionMap.cpp index aeec45be98..bf64e19959 100644 --- a/libraries/octree/src/JurisdictionMap.cpp +++ b/libraries/octree/src/JurisdictionMap.cpp @@ -331,19 +331,19 @@ int JurisdictionMap::unpackFromMessage(unsigned char* sourceBuffer, int availabl // increment to push past the packet header int numBytesPacketHeader = numBytesForPacketHeader(sourceBuffer); sourceBuffer += numBytesPacketHeader; - int remaingingBytes = availableBytes - numBytesPacketHeader; + int remainingBytes = availableBytes - numBytesPacketHeader; // read the root jurisdiction int bytes = 0; memcpy(&bytes, sourceBuffer, sizeof(bytes)); sourceBuffer += sizeof(bytes); - remaingingBytes -= sizeof(bytes); + remainingBytes -= sizeof(bytes); - if (bytes > 0 && bytes <= remaingingBytes) { + if (bytes > 0 && bytes <= remainingBytes) { _rootOctalCode = new unsigned char[bytes]; memcpy(_rootOctalCode, sourceBuffer, bytes); sourceBuffer += bytes; - remaingingBytes -= bytes; + remainingBytes -= bytes; // if and only if there's a root jurisdiction, also include the end nodes int endNodeCount = 0; @@ -353,13 +353,13 @@ int JurisdictionMap::unpackFromMessage(unsigned char* sourceBuffer, int availabl int bytes = 0; memcpy(&bytes, sourceBuffer, sizeof(bytes)); sourceBuffer += sizeof(bytes); - remaingingBytes -= sizeof(bytes); + remainingBytes -= sizeof(bytes); - if (bytes <= remaingingBytes) { + if (bytes <= remainingBytes) { unsigned char* endNodeCode = new unsigned char[bytes]; memcpy(endNodeCode, sourceBuffer, bytes); sourceBuffer += bytes; - remaingingBytes -= bytes; + remainingBytes -= bytes; // if the endNodeCode was 0 length then don't add it if (bytes > 0) {