[sr-dev] git:master:dd0fd701: htable: more checks of updateexpire when item is updated
Daniel-Constantin Mierla
miconda at gmail.com
Fri Sep 18 09:33:33 CEST 2015
Module: kamailio
Branch: master
Commit: dd0fd7011b750e34c595936b6c95759ccb77f786
URL: https://github.com/kamailio/kamailio/commit/dd0fd7011b750e34c595936b6c95759ccb77f786
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-09-18T09:33:20+02:00
htable: more checks of updateexpire when item is updated
---
Modified: modules/htable/ht_api.c
---
Diff: https://github.com/kamailio/kamailio/commit/dd0fd7011b750e34c595936b6c95759ccb77f786.diff
Patch: https://github.com/kamailio/kamailio/commit/dd0fd7011b750e34c595936b6c95759ccb77f786.patch
---
diff --git a/modules/htable/ht_api.c b/modules/htable/ht_api.c
index 1a77376..4e272cc 100644
--- a/modules/htable/ht_api.c
+++ b/modules/htable/ht_api.c
@@ -460,7 +460,10 @@ int ht_set_cell(ht_t *ht, str *name, int type, int_str *val, int mode)
}
cell->next = it->next;
cell->prev = it->prev;
- cell->expire = now + ht->htexpire;
+ if(ht->updateexpire)
+ cell->expire = now + ht->htexpire;
+ else
+ cell->expire = it->expire;
if(it->prev)
it->prev->next = cell;
else
@@ -489,7 +492,10 @@ int ht_set_cell(ht_t *ht, str *name, int type, int_str *val, int mode)
if(mode) ht_slot_unlock(ht, idx);
return -1;
}
- cell->expire = now + ht->htexpire;
+ if(ht->updateexpire)
+ cell->expire = now + ht->htexpire;
+ else
+ cell->expire = it->expire;
cell->next = it->next;
cell->prev = it->prev;
if(it->prev)
@@ -649,7 +655,8 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode,
return NULL;
} else {
it->value.n += val;
- it->expire = now + ht->htexpire;
+ if(ht->updateexpire)
+ it->expire = now + ht->htexpire;
if(old!=NULL)
{
if(old->msize>=it->msize)
More information about the sr-dev
mailing list