stellar support monotonic time and real time
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "macro.h"
|
||||
#include "times.h"
|
||||
#include "tcp_utils.h"
|
||||
#include "udp_utils.h"
|
||||
#include "id_generator.h"
|
||||
@@ -513,9 +514,7 @@ static int duplicated_packet_bypass(struct session_manager *mgr, struct session
|
||||
|
||||
static void session_update(struct session *sess, enum session_state next_state, const struct packet *pkt, const struct tuple6 *key, enum flow_direction dir)
|
||||
{
|
||||
struct timespec real;
|
||||
clock_gettime(CLOCK_REALTIME, &real); // must be realtime
|
||||
|
||||
uint64_t real_sec = stellar_get_real_time_sec();
|
||||
if (session_get_state(sess) == SESSION_STATE_INIT)
|
||||
{
|
||||
session_set_id(sess, id_generator_alloc());
|
||||
@@ -548,7 +547,7 @@ static void session_update(struct session *sess, enum session_state next_state,
|
||||
}
|
||||
|
||||
tuple6_to_str(key, sess->tuple_str, sizeof(sess->tuple_str));
|
||||
session_set_timestamp(sess, SESSION_TIMESTAMP_START, real.tv_sec);
|
||||
session_set_timestamp(sess, SESSION_TIMESTAMP_START, real_sec);
|
||||
switch (key->ip_proto)
|
||||
{
|
||||
case IPPROTO_TCP:
|
||||
@@ -580,7 +579,7 @@ static void session_update(struct session *sess, enum session_state next_state,
|
||||
|
||||
session_set_current_packet(sess, pkt);
|
||||
session_set_flow_direction(sess, dir);
|
||||
session_set_timestamp(sess, SESSION_TIMESTAMP_LAST, real.tv_sec);
|
||||
session_set_timestamp(sess, SESSION_TIMESTAMP_LAST, real_sec);
|
||||
session_set_state(sess, next_state);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user