TPM log exchange time starting from tpm_pay() start

This commit is contained in:
emanuel 2023-05-30 13:05:48 +01:00
parent 39637778e8
commit 5468d7a7eb
2 changed files with 9 additions and 5 deletions

View File

@ -85,6 +85,7 @@ int tpm_pay(tolling_info_t* info, void** security_socket, uint8_t* neighbour, ui
pthread_mutex_lock(&tolling->lock);
tolling->station.obu.t_init = itss_ts_get(TIME_MICROSECONDS);
tolling->station.obu.active = true;
tolling->station.obu.nonce = rand() + 1;
@ -379,11 +380,12 @@ int tpm_pay(tolling_info_t* info, void** security_socket, uint8_t* neighbour, ui
tolling->protocol.p == TOLLING_PROTOCOL_SIMPLE ? "TR.packet.btp" : "TR.packet.tcp");
// Retransmission
uint64_t now = itss_ts_get(TIME_MICROSECONDS);
if (!tolling->station.obu.rt_on) {
tolling->station.obu.rt_init = itss_ts_get(TIME_MICROSECONDS);
tolling->station.obu.rt_init = now;
tolling->station.obu.rt_on = true;
}
tolling->station.obu.rt_t_trigger = itss_ts_get(TIME_MICROSECONDS);
tolling->station.obu.rt_t_trigger = now;
// Logging
if (facilities.logging.dbms) {
@ -1267,7 +1269,7 @@ int tpm_recv(TPM_t* tpm_rx, void** security_socket, uint8_t* neighbour, uint8_t*
goto cleanup;
}
itss_time_lock();
log_info("[tolling] entry.reply took %lld us", itss_ts_get(TIME_MICROSECONDS) - tolling->station.obu.rt_init);
log_info("[tolling] entry.reply took %lld us", itss_ts_get(TIME_MICROSECONDS) - tolling->station.obu.t_init);
itss_time_unlock();
tolling->station.obu.rt_on = false;
veh_handle_recv(tolling, tpm_rx, security_socket, facilities.tx_queue, neighbour, src_addr);
@ -1295,7 +1297,7 @@ int tpm_recv(TPM_t* tpm_rx, void** security_socket, uint8_t* neighbour, uint8_t*
goto cleanup;
}
itss_time_lock();
log_info("[tolling] exit.reply took %lld us", itss_ts_get(TIME_MICROSECONDS) - tolling->station.obu.rt_init);
log_info("[tolling] exit.reply took %lld us", itss_ts_get(TIME_MICROSECONDS) - tolling->station.obu.t_init);
itss_time_unlock();
tolling->station.obu.rt_on = false;
veh_handle_recv(tolling, tpm_rx, security_socket, facilities.tx_queue, neighbour, src_addr);
@ -1320,7 +1322,7 @@ int tpm_recv(TPM_t* tpm_rx, void** security_socket, uint8_t* neighbour, uint8_t*
goto cleanup;
}
itss_time_lock();
log_info("[tolling] single.reply took %lld us", itss_ts_get(TIME_MICROSECONDS) - tolling->station.obu.rt_init);
log_info("[tolling] single.reply took %lld us", itss_ts_get(TIME_MICROSECONDS) - tolling->station.obu.t_init);
itss_time_unlock();
tolling->station.obu.rt_on = false;
veh_handle_recv(tolling, tpm_rx, security_socket, facilities.tx_queue, neighbour, src_addr);

View File

@ -85,6 +85,8 @@ typedef struct tolling {
uint64_t tls_conn_id;
TPM_t* entry_proof;
uint64_t t_init;
// Retransmission
uint64_t rt_init;
uint64_t rt_t_trigger;