fixed socket address
This commit is contained in:
@@ -163,8 +163,9 @@ HTTPServer* FlippRServer::build_output_server()
|
|||||||
{
|
{
|
||||||
unsigned short port = (unsigned short) config().getInt("HTTPTimeServer.port", this->output_port);
|
unsigned short port = (unsigned short) config().getInt("HTTPTimeServer.port", this->output_port);
|
||||||
|
|
||||||
// todo XDG_RUNTIME_DIR
|
std::string runtime_dir = this->get_runtime_dir();
|
||||||
SocketAddress address("/tmp/flippR_driver/S.flippR_driver");
|
|
||||||
|
SocketAddress address(runtime_dir + SOCKET_NAME);
|
||||||
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);
|
||||||
@@ -175,7 +176,8 @@ TCPServer* FlippRServer::build_input_server()
|
|||||||
unsigned short port = (unsigned short) config().getInt("HTTPTimeServer.port", this->output_port);
|
unsigned short port = (unsigned short) config().getInt("HTTPTimeServer.port", this->output_port);
|
||||||
|
|
||||||
//TODO adapt path
|
//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);
|
ServerSocket server_socket(address);
|
||||||
|
|
||||||
return new TCPServer(new input::InputSocketHandlerFactory(this->input_driver), port);
|
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();
|
stopOptionsProcessing();
|
||||||
help_requested = true;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,11 +37,14 @@ private:
|
|||||||
void initialize_input_driver();
|
void initialize_input_driver();
|
||||||
void parse_server_config_file();
|
void parse_server_config_file();
|
||||||
|
|
||||||
|
std::string get_runtime_dir();
|
||||||
Poco::Net::HTTPServer* build_output_server();
|
Poco::Net::HTTPServer* build_output_server();
|
||||||
Poco::Net::TCPServer* build_input_server();
|
Poco::Net::TCPServer* build_input_server();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const std::string DEFAULT_RUNTIME_DIR = "/tmp/flippR_driver-runtime/";
|
||||||
|
const std::string SOCKET_NAME = "S.flippR_driver"
|
||||||
int input_port;
|
int input_port;
|
||||||
int output_port;
|
int output_port;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user