Module: kamailio Branch: master Commit: e5f90cfce9d3ce13eada38cd1e058824d56b99df URL: https://github.com/kamailio/kamailio/commit/e5f90cfce9d3ce13eada38cd1e058824...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-02-02T17:10:37+01:00
dialog: use ksr_time_uint() for getting unsigned int time values
---
Modified: src/modules/dialog/dialog.c Modified: src/modules/dialog/dlg_db_handler.c Modified: src/modules/dialog/dlg_dmq.c Modified: src/modules/dialog/dlg_hash.c
---
Diff: https://github.com/kamailio/kamailio/commit/e5f90cfce9d3ce13eada38cd1e058824... Patch: https://github.com/kamailio/kamailio/commit/e5f90cfce9d3ce13eada38cd1e058824...
---
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c index 6e6bd93aabf..6871cc960e3 100644 --- a/src/modules/dialog/dialog.c +++ b/src/modules/dialog/dialog.c @@ -3323,8 +3323,8 @@ static void rpc_dlg_set_state(rpc_t *rpc, void *c) /* updates for terminated dialogs */ if(ostate == DLG_STATE_CONFIRMED && sval == DLG_STATE_DELETED) { /* updating timestamps, flags, dialog stats */ - dlg->init_ts = (unsigned int)(time(0)); - dlg->end_ts = (unsigned int)(time(0)); + dlg->init_ts = ksr_time_uint(NULL, NULL); + dlg->end_ts = ksr_time_uint(NULL, NULL); } dlg->dflags |= DLG_FLAG_CHANGED;
diff --git a/src/modules/dialog/dlg_db_handler.c b/src/modules/dialog/dlg_db_handler.c index 18ecdcaa6c9..0f18be6e81d 100644 --- a/src/modules/dialog/dlg_db_handler.c +++ b/src/modules/dialog/dlg_db_handler.c @@ -437,13 +437,13 @@ int load_dialog_info_from_db(
dlg->tl.timeout = (unsigned int)(VAL_INT(values + 9)); LM_DBG("db dialog timeout is %u (%u/%u)\n", dlg->tl.timeout, - get_ticks(), (unsigned int)time(0)); - if(dlg->tl.timeout <= (unsigned int)time(0)) { + get_ticks(), ksr_time_uint(NULL, NULL)); + if(dlg->tl.timeout <= ksr_time_uint(NULL, NULL)) { dlg->tl.timeout = 0; dlg->lifetime = 0; } else { dlg->lifetime = dlg->tl.timeout - dlg->start_ts; - dlg->tl.timeout -= (unsigned int)time(0); + dlg->tl.timeout -= ksr_time_uint(NULL, NULL); }
GET_STR_VALUE(cseq1, values, 10, 1, 1); @@ -492,7 +492,7 @@ int load_dialog_info_from_db(
if(dlg->state == DLG_STATE_DELETED) { /* end_ts used for force clean up not stored - set it to now */ - dlg->end_ts = (unsigned int)time(0); + dlg->end_ts = ksr_time_uint(NULL, NULL); } /*restore the timer values */ if(0 != insert_dlg_timer(&(dlg->tl), (int)dlg->tl.timeout)) { @@ -898,7 +898,7 @@ int update_dialog_dbinfo_unsafe(struct dlg_cell *cell) VAL_INT(values + 1) = cell->h_id; VAL_INT(values + 9) = cell->start_ts; VAL_INT(values + 10) = cell->state; - VAL_INT(values + 11) = (unsigned int)((unsigned int)time(0) + VAL_INT(values + 11) = (unsigned int)(ksr_time_uint(NULL, NULL) + cell->tl.timeout - get_ticks());
SET_STR_VALUE(values + 2, cell->callid); @@ -980,7 +980,7 @@ int update_dialog_dbinfo_unsafe(struct dlg_cell *cell) VAL_INT(values) = cell->h_entry; VAL_INT(values + 1) = cell->h_id; VAL_INT(values + 10) = cell->state; - VAL_INT(values + 11) = (unsigned int)((unsigned int)time(0) + VAL_INT(values + 11) = (unsigned int)(ksr_time_uint(NULL, NULL) + cell->tl.timeout - get_ticks());
SET_STR_VALUE(values + 12, cell->cseq[DLG_CALLER_LEG]); diff --git a/src/modules/dialog/dlg_dmq.c b/src/modules/dialog/dlg_dmq.c index bb8a69cffd6..6cd8d898762 100644 --- a/src/modules/dialog/dlg_dmq.c +++ b/src/modules/dialog/dlg_dmq.c @@ -349,7 +349,7 @@ int dlg_dmq_handle_msg( dlg->dflags |= DLG_FLAG_NEW; /* keep dialog around for a bit, to prevent out-of-order * syncs to reestablish the dlg */ - dlg->init_ts = time(NULL); + dlg->init_ts = ksr_time_uint(NULL, NULL); break; default: LM_ERR("unhandled state update to state %u\n", state); diff --git a/src/modules/dialog/dlg_hash.c b/src/modules/dialog/dlg_hash.c index a37adee49d2..58b0311bece 100644 --- a/src/modules/dialog/dlg_hash.c +++ b/src/modules/dialog/dlg_hash.c @@ -225,7 +225,7 @@ int dlg_clean_run(ticks_t ti) dlg_cell_t *dlg; dlg_cell_t *tdlg;
- tm = (unsigned int)time(NULL); + tm = ksr_time_uint(NULL, NULL); for(i = 0; i < d_table->size; i++) { dlg_lock(d_table, &d_table->entries[i]); dlg = d_table->entries[i].first; @@ -474,7 +474,7 @@ struct dlg_cell *build_new_dlg(
memset(dlg, 0, len); dlg->state = DLG_STATE_UNCONFIRMED; - dlg->init_ts = (unsigned int)time(NULL); + dlg->init_ts = ksr_time_uint(NULL, NULL);
dlg->h_entry = core_hash(callid, 0, d_table->size); LM_DBG("new dialog on hash %u\n", dlg->h_entry);