🐞 fix(TSG-15308): 修复packet io thread启动时,intercept_policy_enforcer为空导致core
This commit is contained in:
@@ -177,6 +177,7 @@ struct tfe_proxy
|
||||
};
|
||||
|
||||
extern struct tfe_proxy * g_default_proxy;
|
||||
extern int worker_thread_ready;
|
||||
|
||||
#define TFE_PROXY_STAT_INCREASE(field, val) \
|
||||
do { __atomic_fetch_add(&g_default_proxy->stat_val[field], val, __ATOMIC_RELAXED); } while(0)
|
||||
|
||||
@@ -93,15 +93,19 @@ static void *worker_thread_cycle(void *arg)
|
||||
void * logger = thread_ctx->logger;
|
||||
|
||||
int pkg_len = 0;
|
||||
char thread_name[32];
|
||||
char thread_name[16];
|
||||
int n_pkt_recv_from_nf = 0;
|
||||
int n_pkt_recv_from_tap = 0;
|
||||
int n_pkt_recv_from_tap_c = 0;
|
||||
int n_pkt_recv_from_tap_s = 0;
|
||||
|
||||
snprintf(thread_name, sizeof(thread_name), "packet-io:worker-%d", thread_ctx->thread_index);
|
||||
snprintf(thread_name, sizeof(thread_name), "pkt:worker-%d", thread_ctx->thread_index);
|
||||
prctl(PR_SET_NAME, (unsigned long long)thread_name, NULL, NULL, NULL);
|
||||
|
||||
while (!worker_thread_ready) {
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if (packet_io_thread_init(handle, thread_ctx, logger) != 0)
|
||||
{
|
||||
goto error_out;
|
||||
|
||||
@@ -72,6 +72,7 @@ static int signals[] = {SIGHUP, SIGPIPE, SIGUSR1, SIGUSR2};
|
||||
void * g_default_logger = NULL;
|
||||
struct tfe_proxy * g_default_proxy = NULL;
|
||||
bool g_print_to_stderr = true;
|
||||
int worker_thread_ready = 0;
|
||||
|
||||
/* Per thread resource */
|
||||
thread_local unsigned int __currect_thread_id = 0;
|
||||
@@ -749,6 +750,7 @@ int main(int argc, char * argv[])
|
||||
g_print_to_stderr = false;
|
||||
sleep(1);
|
||||
}
|
||||
worker_thread_ready = 1;
|
||||
|
||||
event_base_dispatch(g_default_proxy->evbase);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user