Feature/documentation topic (#822)

- Implement documentation topic that can be used to query documentation using the network API.
- Implement a way to pass arguments to lua scripts using json (rather than formatting entire lua string clientside)
- Implement ability to attach callback to lua script executions
- Implement abillity to transport return values from lua scripts back to network API clients.
- Do not initialize server interface on slave nodes.
- Implement Dictionary -> json converter using nlohmann json library
This commit is contained in:
Emil Axelsson
2019-04-03 10:30:28 +02:00
committed by GitHub
parent 4ef0bdc0a5
commit 53e07d90e1
30 changed files with 414 additions and 550 deletions

View File

@@ -28,6 +28,8 @@
#include <modules/server/include/connection.h>
#include <modules/server/include/topics/topic.h>
#include <openspace/engine/globalscallbacks.h>
#include <openspace/engine/globals.h>
#include <openspace/engine/windowdelegate.h>
#include <ghoul/fmt.h>
#include <ghoul/io/socket/socket.h>
#include <ghoul/io/socket/tcpsocketserver.h>
@@ -86,7 +88,10 @@ void ServerModule::internalInitialize(const ghoul::Dictionary& configuration) {
std::unique_ptr<ServerInterface> serverInterface =
ServerInterface::createFromDictionary(interfaceDictionary);
serverInterface->initialize();
if (global::windowDelegate.isMaster()) {
serverInterface->initialize();
}
_interfaceOwner.addPropertySubOwner(serverInterface.get());
@@ -101,6 +106,10 @@ void ServerModule::internalInitialize(const ghoul::Dictionary& configuration) {
}
void ServerModule::preSync() {
if (!global::windowDelegate.isMaster()) {
return;
}
// Set up new connections.
for (std::unique_ptr<ServerInterface>& serverInterface : _interfaces) {
if (!serverInterface->isEnabled()) {
@@ -165,7 +174,9 @@ void ServerModule::cleanUpFinishedThreads() {
void ServerModule::disconnectAll() {
for (std::unique_ptr<ServerInterface>& serverInterface : _interfaces) {
serverInterface->deinitialize();
if (global::windowDelegate.isMaster()) {
serverInterface->deinitialize();
}
}
for (ConnectionData& connectionData : _connections) {