Commit 059a1c44 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Improved DOS structure in tport

parent d2be6646
......@@ -3017,8 +3017,8 @@ void tport_recv_event(tport_t *self)
self->tp_dos_stats.recv_msg_count_since_last_check++;
gettimeofday(&now, NULL);
double now_in_millis = now.tv_sec * 1000 + (now.tv_usec / 1000);
double time_elapsed = now_in_millis - self->tp_dos_stats.last_check_recv_msg_check_time;
unsigned long now_in_millis = now.tv_sec * 1000 + (now.tv_usec / 1000);
unsigned long time_elapsed = now_in_millis - self->tp_dos_stats.last_check_recv_msg_check_time;
if (time_elapsed < 0) {
self->tp_dos_stats.packet_count_rate = 0;
self->tp_dos_stats.recv_msg_count_since_last_check = 0;
......
......@@ -248,9 +248,9 @@ struct tport_s {
} tp_stats;
struct {
uint64_t recv_msg_count_since_last_check;
double last_check_recv_msg_check_time;
double packet_count_rate;
uint64_t recv_msg_count_since_last_check;
uint64_t last_check_recv_msg_check_time;
uint64_t packet_count_rate;
} tp_dos_stats;
/* ==== User Data ========================================================*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment