Try change
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#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>
|
||||||
@@ -181,8 +182,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);
|
||||||
|
|
||||||
std::string path = this->create_directory(OUTPUT_SOCKET_NAME);
|
Poco::File socket_file(this->get_runtime_dir() + OUTPUT_SOCKET_NAME);
|
||||||
SocketAddress address(SocketAddress::UNIX_LOCAL, path, port);
|
|
||||||
|
SocketAddress address(SocketAddress::UNIX_LOCAL, 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);
|
||||||
@@ -192,28 +194,14 @@ 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);
|
||||||
|
|
||||||
std::string path = this->create_directory(INPUT_SOCKET_NAME);
|
Poco::File socket_file(this->get_runtime_dir() + INPUT_SOCKET_NAME);
|
||||||
SocketAddress address(SocketAddress::UNIX_LOCAL, path, port);
|
|
||||||
|
SocketAddress address(SocketAddress::UNIX_LOCAL, 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
void FlippRServer::defineOptions(OptionSet& options)
|
||||||
{
|
{
|
||||||
ServerApplication::defineOptions(options);
|
ServerApplication::defineOptions(options);
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ private:
|
|||||||
void initialize_output_driver();
|
void initialize_output_driver();
|
||||||
void initialize_input_driver();
|
void initialize_input_driver();
|
||||||
|
|
||||||
std::string create_directory(std::string file_name);
|
|
||||||
void parse_server_config_file();
|
void parse_server_config_file();
|
||||||
|
|
||||||
std::string get_runtime_dir();
|
std::string get_runtime_dir();
|
||||||
|
|||||||
Reference in New Issue
Block a user