执行resetall指令:Sapp重启后发送resetall状态通知SCE清空流表

This commit is contained in:
luwenpeng
2023-02-17 17:45:39 +08:00
parent e6a3f5c1dc
commit 0ba7fefba5
6 changed files with 73 additions and 2 deletions

View File

@@ -28,7 +28,11 @@ static void *worker_thread_cycle(void *arg)
LOG_INFO("%s: worker thread %d recv %03d packets from endpoint", LOG_TAG_SCE, thread_ctx->thread_index, n_packet_recv);
}
// TODO reset session_table
if (__atomic_fetch_add(&thread_ctx->session_table_need_reset, 0, __ATOMIC_RELAXED) > 0)
{
session_table_reset(thread_ctx->session_table);
__atomic_fetch_and(&thread_ctx->session_table_need_reset, 0, __ATOMIC_RELAXED);
}
}
LOG_ERROR("%s: worker thread %d exiting", LOG_TAG_SCE, thread_ctx->thread_index);
@@ -53,6 +57,8 @@ int main(int argc, char **argv)
ctx->work_threads[i].ref_io = ctx->io;
ctx->work_threads[i].ref_metrics = ctx->metrics;
ctx->work_threads[i].ref_enforcer = ctx->enforcer;
ctx->work_threads[i].ref_sce_ctx = ctx;
ctx->work_threads[i].session_table_need_reset = 0;
}
for (int i = 0; i < ctx->nr_worker_threads; i++)