Skip to content

Commit

Permalink
usrloc federation: Fix metadata cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuchircu committed Apr 17, 2018
1 parent 479b385 commit 763d440
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions modules/usrloc/udomain.c
Expand Up @@ -1154,6 +1154,9 @@ cdb_load_urecord_locations(const udomain_t *_d, const str *_aor, urecord_t *_r)
ucontact_t *ct;
str my_sip_addr;

shm_free_all(_r->remote_aors);
_r->remote_aors = NULL;

if (clusterer_api.get_my_sip_addr(location_cluster, &my_sip_addr) != 0) {
LM_ERR("failed to get local PoP SIP addr\n");
return -1;
Expand Down
2 changes: 2 additions & 0 deletions modules/usrloc/udomain.h
Expand Up @@ -178,6 +178,8 @@ typedef int
(*get_global_urecord_t)(udomain_t* _d, str* _a, struct urecord** _r);
int get_global_urecord(udomain_t* _d, str* _aor, struct urecord** _r);

int cdb_update_urecord_metadata(const str *_aor, int unpublish);


/*! \brief
* Delete a urecord from domain
Expand Down
14 changes: 8 additions & 6 deletions modules/usrloc/urecord.c
Expand Up @@ -113,6 +113,7 @@ void free_urecord(urecord_t* _r)
free_ucontact(ptr);
}

shm_free_all(_r->remote_aors);
store_destroy(_r->kv_storage);

if (have_mem_storage() && !_r->is_static) {
Expand Down Expand Up @@ -736,19 +737,20 @@ void release_urecord(urecord_t* _r, char is_replicated)
free_urecord(_r);
break;
default:
if (cluster_mode == CM_FEDERATION_CACHEDB) {
shm_free_all(_r->remote_aors);
_r->remote_aors = NULL;
}

if (_r->is_static || _r->contacts || _r->no_clear_ref > 0)
return;

if (exists_ulcb_type(UL_AOR_DELETE))
run_ul_callbacks(UL_AOR_DELETE, _r);

if (!is_replicated && location_cluster)
if (!is_replicated) {
if (cluster_mode == CM_FEDERATION_CACHEDB &&
cdb_update_urecord_metadata(&_r->aor, 1) != 0)
LM_ERR("failed to delete metadata, aor: %.*s\n",
_r->aor.len, _r->aor.s);

replicate_urecord_delete(_r);
}

mem_delete_urecord(_r->slot->d, _r);
}
Expand Down

0 comments on commit 763d440

Please sign in to comment.