mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralgw.git
synced 2025-11-06 21:58:02 +00:00
Refactoring namespace and subsystems
This commit is contained in:
@@ -24,25 +24,17 @@
|
||||
#include "RESTAPI_system_command.h"
|
||||
|
||||
#include "RESTAPI_unknownRequestHandler.h"
|
||||
#include "uUtils.h"
|
||||
#include "Utils.h"
|
||||
|
||||
namespace uCentral::RESTAPI {
|
||||
namespace uCentral {
|
||||
|
||||
Service *Service::instance_ = nullptr;
|
||||
class RESTAPI_server *RESTAPI_server::instance_ = nullptr;
|
||||
|
||||
int Start() {
|
||||
return Service::instance()->Start();
|
||||
}
|
||||
|
||||
void Stop() {
|
||||
Service::instance()->Stop();
|
||||
}
|
||||
|
||||
Service::Service() noexcept: uSubSystemServer("RESTAPIServer", "RESTAPIServer", "ucentral.restapi")
|
||||
RESTAPI_server::RESTAPI_server() noexcept: SubSystemServer("RESTAPIServer", "RESTAPIServer", "ucentral.restapi")
|
||||
{
|
||||
}
|
||||
|
||||
int Service::Start() {
|
||||
int RESTAPI_server::Start() {
|
||||
Logger_.information("Starting.");
|
||||
|
||||
for(const auto & Svr: ConfigServersList_) {
|
||||
@@ -66,7 +58,7 @@ namespace uCentral::RESTAPI {
|
||||
// Params->setMaxKeepAliveRequests(200);
|
||||
// Params->setTimeout();
|
||||
|
||||
auto NewServer = std::make_unique<Poco::Net::HTTPServer>(new RequestHandlerFactory, Pool_, Sock, Params);
|
||||
auto NewServer = std::make_unique<Poco::Net::HTTPServer>(new RESTAPIServerRequestHandlerFactory, Pool_, Sock, Params);
|
||||
NewServer->start();
|
||||
RESTServers_.push_back(std::move(NewServer));
|
||||
}
|
||||
@@ -74,7 +66,7 @@ namespace uCentral::RESTAPI {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Poco::Net::HTTPRequestHandler *RequestHandlerFactory::createRequestHandler(const Poco::Net::HTTPServerRequest & Request) {
|
||||
Poco::Net::HTTPRequestHandler *RESTAPIServerRequestHandlerFactory::createRequestHandler(const Poco::Net::HTTPServerRequest & Request) {
|
||||
|
||||
Logger_.debug(Poco::format("REQUEST(%s): %s %s", uCentral::Utils::FormatIPv6(Request.clientAddress().toString()), Request.getMethod(), Request.getURI()));
|
||||
|
||||
@@ -114,7 +106,7 @@ namespace uCentral::RESTAPI {
|
||||
return new RESTAPI_UnknownRequestHandler(bindings,Logger_);
|
||||
}
|
||||
|
||||
void Service::Stop() {
|
||||
void RESTAPI_server::Stop() {
|
||||
Logger_.information("Stopping ");
|
||||
for( const auto & svr : RESTServers_ )
|
||||
svr->stop();
|
||||
|
||||
Reference in New Issue
Block a user