Added init request handling for non-hosts

osparallelconnection is no longer a property owner
This commit is contained in:
Joakim Kilby
2015-06-23 11:33:20 +02:00
parent 77720b6985
commit b6bd205304
2 changed files with 20 additions and 5 deletions

View File

@@ -26,8 +26,6 @@
#define __OSPARALLELCONNECTION_H__
//openspace includes
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/propertyowner.h>
#include <openspace/scripting/scriptengine.h>
#include <openspace/util/powerscaledcoordinate.h>
@@ -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();

View File

@@ -204,7 +204,6 @@ namespace openspace {
}
void OSParallelConnection::authenticate(){
int pos = 4;
uint16_t namelen = static_cast<uint16_t>(_name.length());
int size = headerSize + sizeof(uint32_t) + sizeof(uint16_t) + static_cast<int>(namelen);
std::vector<char> 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<char> 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<char*>(&type), reinterpret_cast<char*>(&type) + sizeof(int));
//send message
send(_clientSocket, buffer.data(), buffer.size(), 0);
}
}
else{