Try change

This commit is contained in:
Johannes Wendel
2019-08-28 18:31:59 +02:00
parent 8d2878eb5e
commit 46ea13b13a
2 changed files with 7 additions and 20 deletions

View File

@@ -13,6 +13,7 @@
#include <Poco/Net/HTTPServer.h>
#include <Poco/Util/HelpFormatter.h>
#include <Poco/JSON/Parser.h>
#include <Poco/File.h>
#include <iostream>
#include <fstream>
@@ -181,8 +182,9 @@ HTTPServer* FlippRServer::build_output_server()
{
unsigned short port = (unsigned short) config().getInt("FlippRServer.port", this->output_port);
std::string path = this->create_directory(OUTPUT_SOCKET_NAME);
SocketAddress address(SocketAddress::UNIX_LOCAL, path, port);
Poco::File socket_file(this->get_runtime_dir() + OUTPUT_SOCKET_NAME);
SocketAddress address(SocketAddress::UNIX_LOCAL, socket_file.path());
ServerSocket server_socket(address);
return new HTTPServer(new OutputRequestHandlerFactory(this->output_driver), server_socket, new HTTPServerParams);
@@ -192,28 +194,14 @@ TCPServer* FlippRServer::build_input_server()
{
unsigned short port = (unsigned short) config().getInt("FlippRServer.port", this->input_port);
std::string path = this->create_directory(INPUT_SOCKET_NAME);
SocketAddress address(SocketAddress::UNIX_LOCAL, path, port);
Poco::File socket_file(this->get_runtime_dir() + INPUT_SOCKET_NAME);
SocketAddress address(SocketAddress::UNIX_LOCAL, socket_file.path());
ServerSocket server_socket(address);
return new TCPServer(new input::InputSocketHandlerFactory(this->input_driver), server_socket);
}
std::string FlippRServer::create_directory(std::string file_name)
{
std::string runtime_dir = this->get_runtime_dir();
fs::path path = runtime_dir;
if(!fs::exists(path))
{
fs::create_directory(path);
}
path += file_name;
return path.string();
}
void FlippRServer::defineOptions(OptionSet& options)
{
ServerApplication::defineOptions(options);