fixed socket address

This commit is contained in:
Jonas Zeunert
2019-06-19 22:55:18 +02:00
parent bd5f795da4
commit 1b4639277e
2 changed files with 16 additions and 3 deletions

View File

@@ -163,8 +163,9 @@ HTTPServer* FlippRServer::build_output_server()
{
unsigned short port = (unsigned short) config().getInt("HTTPTimeServer.port", this->output_port);
// todo XDG_RUNTIME_DIR
SocketAddress address("/tmp/flippR_driver/S.flippR_driver");
std::string runtime_dir = this->get_runtime_dir();
SocketAddress address(runtime_dir + SOCKET_NAME);
ServerSocket server_socket(address);
return new HTTPServer(new OutputRequestHandlerFactory(this->output_driver), server_socket, new HTTPServerParams);
@@ -175,7 +176,8 @@ TCPServer* FlippRServer::build_input_server()
unsigned short port = (unsigned short) config().getInt("HTTPTimeServer.port", this->output_port);
//TODO adapt path
SocketAddress address("/tmp/flippR_driver/S.flippR_driver");
std::string runtime_dir = this->get_runtime_dir();
SocketAddress address(runtime_dir + SOCKET_NAME);
ServerSocket server_socket(address);
return new TCPServer(new input::InputSocketHandlerFactory(this->input_driver), port);
@@ -290,6 +292,14 @@ void FlippRServer::handle_help(const std::string& name, const std::string& value
stopOptionsProcessing();
help_requested = true;
}
std::string FlippRServer::get_runtime_dir()
{
std::string runtime_dir = std::getenv("XDG_RUNTIME_DIR");
if(runtime_dir == "")
{
runtime_dir = DEFAULT_RUNTIME_DIR;
}
}
}
}