Module: kamailio
Branch: master
Commit: 9abe414a186e2a6e9041dd03a1a8968f0efa954d
URL: 
https://github.com/kamailio/kamailio/commit/9abe414a186e2a6e9041dd03a1a8968f0efa954d

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-12-20T08:53:04+01:00

htable: get current time once for pv counting items

---

Modified: src/modules/htable/ht_api.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/9abe414a186e2a6e9041dd03a1a8968f0efa954d.diff
Patch: 
https://github.com/kamailio/kamailio/commit/9abe414a186e2a6e9041dd03a1a8968f0efa954d.patch

---

diff --git a/src/modules/htable/ht_api.c b/src/modules/htable/ht_api.c
index 45eda69e359..559ee9784d2 100644
--- a/src/modules/htable/ht_api.c
+++ b/src/modules/htable/ht_api.c
@@ -1576,6 +1576,7 @@ int ht_count_cells_re(str *sre, ht_t *ht, int mode)
        str sval;
        str tval;
        int ival = 0;
+       time_t tnow = 0;
 
        if(sre == NULL || sre->len <= 0 || ht == NULL)
                return 0;
@@ -1655,12 +1656,13 @@ int ht_count_cells_re(str *sre, ht_t *ht, int mode)
                }
        }
 
+       tnow = time(NULL);
        for(i = 0; i < ht->htsize; i++) {
                /* free entries */
                ht_slot_lock(ht, i);
                it = ht->entries[i].first;
                while(it) {
-                       if(ht->htexpire > 0 && it->expire != 0 && it->expire < 
time(NULL)) {
+                       if(ht->htexpire > 0 && it->expire != 0 && it->expire < 
tnow) {
                                /* entry has expired, continue */
                                it = it->next;
                                continue;

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to