Skip to content

Commit

Permalink
usrloc cluster: Include rec.kv_storage in AoR replication
Browse files Browse the repository at this point in the history
Addresses the following mid-registrar errors:

ERROR:mid_registrar:unregister_record: 'from' key not found, skipping De-REGISTER
ERROR:mid_registrar:mid_reg_aor_event: failed to unregister contact

Many thanks to Denys Pozniak for reporting and helping with testing!
  • Loading branch information
liviuchircu committed Feb 3, 2025
1 parent 7e8cc33 commit 343f452
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 13 additions & 1 deletion modules/usrloc/ul_cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,16 @@ int ul_init_cluster(void)

static inline void bin_push_urecord(bin_packet_t *packet, urecord_t *r)
{
str st;

bin_push_str(packet, r->domain);
bin_push_str(packet, &r->aor);
bin_push_int(packet, r->label);
bin_push_int(packet, r->next_clabel);

st = store_serialize(r->kv_storage);
bin_push_str(packet, &st);
store_free_buffer(&st);
}

void replicate_urecord_insert(urecord_t *r)
Expand Down Expand Up @@ -420,10 +426,11 @@ void replicate_ucontact_delete(urecord_t *r, ucontact_t *c,
*/
static int receive_urecord_insert(bin_packet_t *packet)
{
str d, aor;
str d, aor, kv_str;
urecord_t *r;
udomain_t *domain;
int sl;
short pkg_ver = get_bin_pkg_version(packet);

bin_pop_str(packet, &d);
bin_pop_str(packet, &aor);
Expand Down Expand Up @@ -454,6 +461,11 @@ static int receive_urecord_insert(bin_packet_t *packet)
if (domain->table[sl].next_label <= r->label)
domain->table[sl].next_label = r->label + 1;

if (pkg_ver >= UL_BIN_V5) {
bin_pop_str(packet, &kv_str);
r->kv_storage = store_deserialize(&kv_str);
}

out:
unlock_udomain(domain, &aor);

Expand Down
3 changes: 2 additions & 1 deletion modules/usrloc/ul_cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
#define UL_BIN_V2 2
#define UL_BIN_V3 3 // added "cmatch" (default: CT_MATCH_CONTACT_CALLID)
#define UL_BIN_V4 4 // changed 'ct.cflags' from int bitmask to string repr
#define UL_BIN_VERSION UL_BIN_V4
#define UL_BIN_V5 5 // added 'r.kv_storage' to AoR INSERT packets
#define UL_BIN_VERSION UL_BIN_V5

extern int location_cluster;
extern struct clusterer_binds clusterer_api;
Expand Down

0 comments on commit 343f452

Please sign in to comment.