Skip to content

Commit

Permalink
htable: more checks of updateexpire when item is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Sep 18, 2015
1 parent bda43b9 commit dd0fd70
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions modules/htable/ht_api.c
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit dd0fd70

Please sign in to comment.