diff options
| -rw-r--r-- | src/stellar/stellar_core.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/stellar/stellar_core.cpp b/src/stellar/stellar_core.cpp index 79de2b6..f9cf318 100644 --- a/src/stellar/stellar_core.cpp +++ b/src/stellar/stellar_core.cpp @@ -166,9 +166,9 @@ static void *work_thread(void *arg) memset(packets, 0, sizeof(packets)); - for(int i=0; i<RX_BURST_MAX; i++) + for (int i = 0; i < RX_BURST_MAX; i++) { - packet_set_user_data(&packets[i], (void *)plug_mgr); + packet_set_user_data(&packets[i], (void *)plug_mgr); } snprintf(thd_name, sizeof(thd_name), "stellar:%d", thr_idx); @@ -194,7 +194,6 @@ static void *work_thread(void *arg) * Suggestion: After modifying the system time, restart the service to ensure consistent timing. */ now_ms = stellar_get_real_time_msec(); - //memset(packets, 0, sizeof(packets)); nr_recv = packet_io_ingress(packet_io, thr_idx, packets, RX_BURST_MAX); if (nr_recv == 0) { @@ -218,12 +217,10 @@ static void *work_thread(void *arg) else { pkt = defraged_pkt; - plugin_manager_on_packet_ingress(plug_mgr, pkt); - plugin_manager_on_packet_egress(plug_mgr, pkt); + plugin_manager_on_packet_ingress(plug_mgr, defraged_pkt); } } - pkt = &packets[i]; sess = session_manager_lookup_session_by_packet(sess_mgr, pkt); if (sess == NULL) { @@ -250,7 +247,15 @@ static void *work_thread(void *arg) fast_path: plugin_manager_on_session_egress(sess, pkt); - plugin_manager_on_packet_egress(plug_mgr, pkt); + if (pkt == defraged_pkt) + { + plugin_manager_on_packet_egress(plug_mgr, defraged_pkt); + plugin_manager_on_packet_egress(plug_mgr, &packets[i]); + } + else + { + plugin_manager_on_packet_egress(plug_mgr, pkt); + } if (sess && session_get_current_state(sess) == SESSION_STATE_DISCARD) { @@ -435,7 +440,7 @@ static void stellar_thread_join(struct stellar_runtime *runtime, struct stellar_ int stellar_run(int argc __attribute__((unused)), char **argv __attribute__((unused))) { - static struct stellar st={}; + static struct stellar st = {}; struct stellar_runtime *runtime = &st.runtime; struct stellar_config *config = &st.config; |
