From 3b976500ce5e1ba5ba177d148b161cc18248a182 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 18 Sep 2013 17:55:13 -0700 Subject: [PATCH] stylistic and memory management fixes --- domain-server/src/main.cpp | 5 +++-- libraries/shared/src/Assignment.cpp | 2 +- libraries/shared/src/Assignment.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/domain-server/src/main.cpp b/domain-server/src/main.cpp index 7daada3452..5c9638f7dc 100644 --- a/domain-server/src/main.cpp +++ b/domain-server/src/main.cpp @@ -386,14 +386,15 @@ int main(int argc, const char* argv[]) { delete *assignment; } } else { + Assignment *sentAssignment = *assignment; // remove the assignment from the queue ::assignmentQueue.erase(assignment); - if ((*assignment)->getType() != Assignment::VoxelServerType) { + if (sentAssignment->getType() != Assignment::VoxelServerType) { // keep audio-mixer and avatar-mixer assignments in the queue // until we get a check-in from that GUID // but stick it at the back so the others have a chance to go out - ::assignmentQueue.push_back(*assignment); + ::assignmentQueue.push_back(sentAssignment); } } diff --git a/libraries/shared/src/Assignment.cpp b/libraries/shared/src/Assignment.cpp index 4c68188d31..88d50aee28 100644 --- a/libraries/shared/src/Assignment.cpp +++ b/libraries/shared/src/Assignment.cpp @@ -55,7 +55,7 @@ Assignment::Assignment(const unsigned char* dataBuffer, int numBytes) : memcpy(&_type, dataBuffer + numBytesRead, sizeof(Assignment::Type)); numBytesRead += sizeof(Assignment::Type); - if (dataBuffer[0] != PACKET_TYPE_REQUEST_ASSIGNMENT) { + if (_command != Assignment::RequestCommand) { // read the GUID for this assignment _uuid = QUuid::fromRfc4122(QByteArray((const char*) dataBuffer + numBytesRead, NUM_BYTES_RFC4122_UUID)); numBytesRead += NUM_BYTES_RFC4122_UUID; diff --git a/libraries/shared/src/Assignment.h b/libraries/shared/src/Assignment.h index 57c52f5630..9e9f08fee0 100644 --- a/libraries/shared/src/Assignment.h +++ b/libraries/shared/src/Assignment.h @@ -43,7 +43,7 @@ public: Assignment(Assignment::Command command, Assignment::Type type, - Assignment::Location location = Assignment::GlobalLocation); + Assignment::Location location = Assignment::LocalLocation); /// Constructs an Assignment from the data in the buffer /// \param dataBuffer the source buffer to un-pack the assignment from