fix(userspace/falco): solve issues with minimal build

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce
2023-02-08 21:56:49 +00:00
committed by poiana
parent 3d6393ae62
commit 1eb915bf2f
2 changed files with 10 additions and 3 deletions

View File

@@ -17,14 +17,15 @@ limitations under the License.
#include "actions.h"
#ifndef MINIMAL_BUILD
#include "grpc_server.h"
#endif
using namespace falco::app;
using namespace falco::app::actions;
falco::app::run_result falco::app::actions::start_grpc_server(falco::app::state& s)
{
#ifndef MINIMAL_BUILD
// gRPC server
if(s.config->m_grpc_enabled)
{
@@ -43,17 +44,19 @@ falco::app::run_result falco::app::actions::start_grpc_server(falco::app::state&
s.grpc_server.run();
});
}
#endif
return run_result::ok();
}
falco::app::run_result falco::app::actions::stop_grpc_server(falco::app::state& s)
{
#ifndef MINIMAL_BUILD
if(s.grpc_server_thread.joinable())
{
s.grpc_server.shutdown();
s.grpc_server_thread.join();
}
#endif
return run_result::ok();
}

View File

@@ -17,14 +17,15 @@ limitations under the License.
#include "actions.h"
#ifndef MINIMAL_BUILD
#include "webserver.h"
#endif
using namespace falco::app;
using namespace falco::app::actions;
falco::app::run_result falco::app::actions::start_webserver(falco::app::state& s)
{
#ifndef MINIMAL_BUILD
if(!s.is_capture_mode() && s.config->m_webserver_enabled)
{
std::string ssl_option = (s.config->m_webserver_ssl_enabled ? " (SSL)" : "");
@@ -42,15 +43,18 @@ falco::app::run_result falco::app::actions::start_webserver(falco::app::state& s
s.config->m_webserver_ssl_certificate,
s.config->m_webserver_ssl_enabled);
}
#endif
return run_result::ok();
}
falco::app::run_result falco::app::actions::stop_webserver(falco::app::state& s)
{
#ifndef MINIMAL_BUILD
if(!s.is_capture_mode())
{
s.webserver.stop();
}
#endif
return run_result::ok();
}