Sfoglia il codice sorgente

htable: use proper variable to set the expire along with the value

Daniel-Constantin Mierla 7 anni fa
parent
commit
13bb3732af
1 ha cambiato i file con 4 aggiunte e 7 eliminazioni
  1. 4 7
      src/modules/htable/ht_api.c

+ 4 - 7
src/modules/htable/ht_api.c

@@ -597,8 +597,7 @@ int ht_set_cell_ex(ht_t *ht, str *name, int type, int_str *val, int mode,
 	}
 	/* add */
 	cell = ht_cell_new(name, type, val, hid);
-	if(cell == NULL)
-	{
+	if(cell == NULL) {
 		LM_ERR("cannot create new cell.\n");
 		if(mode) ht_slot_unlock(ht, idx);
 		return -1;
@@ -606,12 +605,10 @@ int ht_set_cell_ex(ht_t *ht, str *name, int type, int_str *val, int mode,
 	if(exv<=0) {
 		cell->expire = now + ht->htexpire;
 	} else {
-		it->expire = now + exv;
+		cell->expire = now + exv;
 	}
-	if(prev==NULL)
-	{
-		if(ht->entries[idx].first!=NULL)
-		{
+	if(prev==NULL) {
+		if(ht->entries[idx].first!=NULL) {
 			cell->next = ht->entries[idx].first;
 			ht->entries[idx].first->prev = cell;
 		}