55 lines
1.1 KiB
C
55 lines
1.1 KiB
C
#define TRACE_MODULE _sgw_main
|
|
|
|
#include "core_debug.h"
|
|
#include "core_signal.h"
|
|
#include "core_semaphore.h"
|
|
|
|
#include "common/context.h"
|
|
#include "common/application.h"
|
|
|
|
#include "app_init.h"
|
|
|
|
status_t app_initialize(
|
|
const char *config_path, const char *log_path, const char *pid_path)
|
|
{
|
|
status_t rv;
|
|
int app = 0;
|
|
|
|
rv = app_log_pid(pid_path, "sgw");
|
|
if (rv != CORE_OK) return rv;
|
|
|
|
rv = app_will_initialize(config_path, log_path);
|
|
if (rv != CORE_OK) return rv;
|
|
|
|
app = context_self()->logger.trace.app;
|
|
if (app)
|
|
{
|
|
d_trace_level(&_sgw_main, app);
|
|
}
|
|
|
|
d_trace(1, "SGW try to initialize\n");
|
|
rv = sgw_initialize();
|
|
if (rv != CORE_OK)
|
|
{
|
|
d_error("Failed to intialize SGW");
|
|
return rv;
|
|
}
|
|
d_trace(1, "SGW initialize...done\n");
|
|
|
|
rv = app_did_initialize();
|
|
if (rv != CORE_OK) return rv;
|
|
|
|
return CORE_OK;
|
|
}
|
|
|
|
void app_terminate(void)
|
|
{
|
|
app_will_terminate();
|
|
|
|
d_trace(1, "SGW try to terminate\n");
|
|
sgw_terminate();
|
|
d_trace(1, "SGW terminate...done\n");
|
|
|
|
app_did_terminate();
|
|
}
|