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

Author: Bastian Triller <bastian.tril...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-01-06T13:18:45+01:00

htable: Fix de-/increment w/ auto expire

Update item expiration value during de-/incrementation for htables that
are configured with autoexpire and updateexpire disabled.
Otherwise an item cannot be used until timer cleaned it up.

---

Modified: src/modules/htable/ht_api.c

---

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

---

diff --git a/src/modules/htable/ht_api.c b/src/modules/htable/ht_api.c
index 559ee9784d2..9190dd310ff 100644
--- a/src/modules/htable/ht_api.c
+++ b/src/modules/htable/ht_api.c
@@ -743,6 +743,10 @@ ht_cell_t *ht_cell_value_add(ht_t *ht, str *name, int val, 
ht_cell_t *old)
                        if(now > 0 && it->expire != 0 && it->expire < now) {
                                /* entry has expired */
 
+                               it->expire = ht->htexpire;
+                               if(it->expire) {
+                                       it->expire += now;
+                               }
                                if(ht->flags == PV_VAL_INT) {
                                        /* initval is integer, use it to create 
a fresh entry */
                                        it->flags &= ~AVP_VAL_STR;

_______________________________________________
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