From b6bd20530490d98dbf05eb037c529d3a4b174cce Mon Sep 17 00:00:00 2001 From: Joakim Kilby Date: Tue, 23 Jun 2015 11:33:20 +0200 Subject: [PATCH] Added init request handling for non-hosts osparallelconnection is no longer a property owner --- .../openspace/network/osparallelconnection.h | 5 +---- src/network/osparallelconnection.cpp | 20 ++++++++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/openspace/network/osparallelconnection.h b/include/openspace/network/osparallelconnection.h index edcff7ae2a..cb03302abd 100644 --- a/include/openspace/network/osparallelconnection.h +++ b/include/openspace/network/osparallelconnection.h @@ -26,8 +26,6 @@ #define __OSPARALLELCONNECTION_H__ //openspace includes -#include -#include #include #include @@ -95,11 +93,10 @@ namespace openspace{ //timestamp size = sizeof(_timeStamp); memcpy(&_timeStamp, buffer.data() + offset, size); - offset += size; }; }; - class OSParallelConnection : public properties::PropertyOwner { + class OSParallelConnection{ public: OSParallelConnection(); diff --git a/src/network/osparallelconnection.cpp b/src/network/osparallelconnection.cpp index 1332253da9..c9607cb648 100644 --- a/src/network/osparallelconnection.cpp +++ b/src/network/osparallelconnection.cpp @@ -204,7 +204,6 @@ namespace openspace { } void OSParallelConnection::authenticate(){ - int pos = 4; uint16_t namelen = static_cast(_name.length()); int size = headerSize + sizeof(uint32_t) + sizeof(uint16_t) + static_cast(namelen); std::vector buffer; @@ -355,6 +354,25 @@ namespace openspace { else{ //we were not host so nothing to do } + + //request init packages from the host + int size = headerSize + sizeof(uint32_t); + std::vector buffer; + buffer.reserve(size); + + //version + buffer.insert(buffer.end(), 'O'); + buffer.insert(buffer.end(), 'S'); + buffer.insert(buffer.end(), 0); + buffer.insert(buffer.end(), 0); + + //msg type, 0 = auth + int type = MessageTypes::InitializationRequest; + buffer.insert(buffer.end(), reinterpret_cast(&type), reinterpret_cast(&type) + sizeof(int)); + + //send message + send(_clientSocket, buffer.data(), buffer.size(), 0); + } } else{