增加MESA_handle_logger

This commit is contained in:
luwenpeng
2023-02-20 11:16:34 +08:00
parent 6eaad28f9c
commit 82ac815b68
10 changed files with 108 additions and 95 deletions

View File

@@ -1,11 +1,21 @@
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <pthread.h>
#include "sce.h"
#include "log.h"
#include "utils.h"
static void sig_handler(int signo)
{
if (signo == SIGHUP)
{
LOG_INFO("%s: recv SIGHUP, reload zlog.conf", LOG_TAG_SCE);
LOG_RELOAD();
}
}
static void *worker_thread_cycle(void *arg)
{
struct thread_ctx *thread_ctx = (struct thread_ctx *)arg;
@@ -43,9 +53,22 @@ int main(int argc, char **argv)
{
const char *profile = "./conf/sce.conf";
if (LOG_INIT("./conf/zlog.conf") == -1)
{
return -1;
}
if (signal(SIGHUP, sig_handler) == SIG_ERR)
{
LOG_ERROR("%s: unable to register SIGHUP signal handler, error %d: %s", LOG_TAG_SCE, errno, strerror(errno));
LOG_CLOSE();
return -1;
}
struct sce_ctx *ctx = sce_ctx_create(profile);
if (ctx == NULL)
{
LOG_CLOSE();
return -1;
}
@@ -85,5 +108,7 @@ error_out:
}
sce_ctx_destory(ctx);
LOG_CLOSE();
return 0;
}

View File

@@ -1001,7 +1001,7 @@ forward:
static void forward_all_sf_packet_to_nf(struct packet_io *handle, marsio_buff_t *rx_buff, int thread_seq, void *ctx)
{
struct thread_ctx *thread = (struct thread_ctx *)ctx;
struct global_metrics *g_metrics = thread->ref_metrics;
// struct global_metrics *g_metrics = thread->ref_metrics;
// vxlan decode
struct g_vxlan *g_vxlan_hdr = NULL;
@@ -1145,7 +1145,7 @@ static int handle_session_closing(struct metadata *meta, struct ctrl_pkt_parser
static int handle_session_active(struct metadata *meta, struct ctrl_pkt_parser *parser, int thread_seq, void *ctx)
{
struct thread_ctx *thread = (struct thread_ctx *)ctx;
struct global_metrics *g_metrics = thread->ref_metrics;
// struct global_metrics *g_metrics = thread->ref_metrics;
struct session_node *node = session_table_search_by_id(thread->session_table, meta->session_id);
if (node)