This commit is contained in:
Johannes Wendel
2019-10-09 19:55:07 +02:00
parent ac7c2e41b2
commit e086d79da3
2 changed files with 9 additions and 6 deletions

View File

@@ -13,7 +13,6 @@
#include <Poco/Net/HTTPServer.h> #include <Poco/Net/HTTPServer.h>
#include <Poco/Util/HelpFormatter.h> #include <Poco/Util/HelpFormatter.h>
#include <Poco/JSON/Parser.h> #include <Poco/JSON/Parser.h>
#include <Poco/File.h>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
@@ -182,9 +181,9 @@ HTTPServer* FlippRServer::build_output_server()
{ {
unsigned short port = (unsigned short) config().getInt("FlippRServer.port", this->output_port); unsigned short port = (unsigned short) config().getInt("FlippRServer.port", this->output_port);
Poco::File socket_file(this->get_runtime_dir() + OUTPUT_SOCKET_NAME); output_socket_file = Poco::File(this->get_runtime_dir() + OUTPUT_SOCKET_NAME);
SocketAddress address(SocketAddress::UNIX_LOCAL, socket_file.path()); SocketAddress address(SocketAddress::UNIX_LOCAL, output_socket_file.path());
ServerSocket server_socket(address); ServerSocket server_socket(address);
return new HTTPServer(new OutputRequestHandlerFactory(this->output_driver), server_socket, new HTTPServerParams); return new HTTPServer(new OutputRequestHandlerFactory(this->output_driver), server_socket, new HTTPServerParams);
@@ -194,9 +193,9 @@ TCPServer* FlippRServer::build_input_server()
{ {
unsigned short port = (unsigned short) config().getInt("FlippRServer.port", this->input_port); unsigned short port = (unsigned short) config().getInt("FlippRServer.port", this->input_port);
Poco::File socket_file(this->get_runtime_dir() + INPUT_SOCKET_NAME); input_socket_file = Poco::File(this->get_runtime_dir() + INPUT_SOCKET_NAME);
SocketAddress address(SocketAddress::UNIX_LOCAL, socket_file.path()); SocketAddress address(SocketAddress::UNIX_LOCAL, input_socket_file.path());
ServerSocket server_socket(address); ServerSocket server_socket(address);
return new TCPServer(new input::InputSocketHandlerFactory(this->input_driver), server_socket); return new TCPServer(new input::InputSocketHandlerFactory(this->input_driver), server_socket);
@@ -262,7 +261,8 @@ void FlippRServer::handle_help(const std::string& name, const std::string& value
std::string FlippRServer::get_runtime_dir() std::string FlippRServer::get_runtime_dir()
{ {
return std::getenv("XDG_RUNTIME_DIR") ? std::getenv("XDG_RUNTIME_DIR") : DEFAULT_RUNTIME_DIR; return DEFAULT_RUNTIME_DIR;
//return std::getenv("XDG_RUNTIME_DIR") ? std::getenv("XDG_RUNTIME_DIR") : DEFAULT_RUNTIME_DIR;
} }
} }

View File

@@ -11,6 +11,7 @@
#include <Poco/Util/ServerApplication.h> #include <Poco/Util/ServerApplication.h>
#include <Poco/Net/HTTPServer.h> #include <Poco/Net/HTTPServer.h>
#include <Poco/Dynamic/Struct.h> #include <Poco/Dynamic/Struct.h>
#include <Poco/File.h>
namespace flippR_driver namespace flippR_driver
{ {
@@ -62,6 +63,8 @@ private:
std::unique_ptr<Poco::Net::HTTPServer> output_server; std::unique_ptr<Poco::Net::HTTPServer> output_server;
std::unique_ptr<Poco::Net::TCPServer> input_server; std::unique_ptr<Poco::Net::TCPServer> input_server;
Poco::File output_socket_file, input_socket_file;
}; };
}; };