Skip to content

Commit

Permalink
b2b_entities: fix restoring of DB persisted server entities
Browse files Browse the repository at this point in the history
Server entities restored from DB would not use the original To tag due to
regenerating the timestamp part of the entity key.

(cherry picked from commit dd237c0)
  • Loading branch information
rvlad-patrascu committed Nov 9, 2020
1 parent 47125eb commit 15b401e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions modules/b2b_entities/dlg.c
Expand Up @@ -236,19 +236,18 @@ str* b2b_htable_insert(b2b_table table, b2b_dlg_t* dlg, int hash_index, int src,
return NULL;
}

if(src == B2B_SERVER)
if(src == B2B_SERVER && !reload)
{
dlg->tag[CALLEE_LEG].s = (char*)shm_malloc(b2b_key->len);
if(dlg->tag[CALLEE_LEG].s == NULL)
{
LM_ERR("No more shared memory\n");
if(!reload)
lock_release(&table[hash_index].lock);
lock_release(&table[hash_index].lock);
return 0;
}
memcpy(dlg->tag[CALLEE_LEG].s, b2b_key->s, b2b_key->len);
dlg->tag[CALLEE_LEG].len = b2b_key->len;
if(!reload && b2be_db_mode == WRITE_THROUGH)
if(b2be_db_mode == WRITE_THROUGH)
b2be_db_insert(dlg, src);
}

Expand Down

0 comments on commit 15b401e

Please sign in to comment.