Refactored packet IO to use packet_manager_schedule_packet() instead of stellar_send_build_packet() to send user-built packets

This commit is contained in:
luwenpeng
2024-10-09 11:46:53 +08:00
parent 0f082d975e
commit 9e954386fd
9 changed files with 77 additions and 159 deletions

View File

@@ -100,10 +100,12 @@ static void *worker_thread(void *arg)
if (packet_get_action(pkt) == PACKET_ACTION_DROP)
{
packet_io_drop(pkt_io, thread_id, pkt, 1);
packet_free(pkt);
}
else
{
packet_io_egress(pkt_io, thread_id, pkt, 1);
packet_free(pkt);
}
stellar_polling_dispatch(polling_mgr);
}
@@ -281,40 +283,6 @@ void stellar_reload_log_level(struct stellar *st)
}
}
/******************************************************************************
* Stellar Utility Function
******************************************************************************/
// TODO
#if 0
// only send user build packet, can't send packet which come from network
void stellar_send_build_packet(struct stellar *st, struct packet *pkt)
{
uint16_t thread_id = stellar_module_manager_get_thread_id(st->st.mod_mgr);
struct packet_io *pkt_io = st->st.pkt_io;
struct session_manager_runtime *sess_mgr_rt = st->st.threads[thread_id].sess_mgr_rt;
session_manager_runtime_record_duplicated_packet(sess_mgr_rt, pkt);
if (packet_is_claim(pkt))
{
PACKET_LOG_ERROR("packet has been claimed and cannot be released, please check the module arrangement order");
assert(0);
return;
}
if (packet_get_origin_ctx(pkt))
{
// TODO
abort();
packet_io_egress(pkt_io, thread_id, pkt, 1);
}
else
{
packet_io_inject(pkt_io, thread_id, pkt, 1);
}
}
#endif
struct logger *stellar_get_logger(struct stellar *st)
{
if (st)