MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / receive_entity_ack

Function receive_entity_ack

modules/b2b_logic/entity_storage.c:529–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527}
528
529static void receive_entity_ack(enum b2b_entity_type entity_type,
530 str *entity_key, str *b2bl_key, bin_packet_t *storage)
531{
532 unsigned int hash_index, local_index;
533 b2bl_tuple_t* tuple = NULL;
534 int tuple_repl_type;
535 int lifetime;
536
537 LM_DBG("Received ACK event for entity [%.*s]\n",
538 entity_key->len, entity_key->s);
539
540 if (b2bl_parse_key(b2bl_key, &hash_index, &local_index) < 0) {
541 LM_ERR("Bad tuple key: %.*s\n", b2bl_key->len, b2bl_key->s);
542 return;
543 }
544
545 B2BL_LOCK_GET(hash_index);
546
547 tuple = b2bl_search_tuple_safe(hash_index, local_index);
548 if (!tuple) {
549 LM_ERR("Tuple [%.*s] not found\n", b2bl_key->len, b2bl_key->s);
550 B2BL_LOCK_RELEASE(hash_index);
551 return;
552 }
553
554 bin_pop_int(storage, &tuple_repl_type);
555 if (tuple_repl_type != REPL_TUPLE_UPDATE) {
556 LM_ERR("Bad tuple replication type: %d\n", tuple_repl_type);
557 B2BL_LOCK_RELEASE(hash_index);
558 return;
559 }
560
561 bin_pop_int(storage, &tuple->state);
562 bin_pop_int(storage, &lifetime);
563
564 tuple->lifetime = lifetime ? get_ticks() + lifetime : 0;
565
566 if (unpack_context_vals(tuple, storage) < 0)
567 LM_ERR("Failed to unpack context values\n");
568
569 B2BL_LOCK_RELEASE(hash_index);
570}
571
572static void receive_entity_delete(enum b2b_entity_type entity_type,
573 str *entity_key, str *b2bl_key, bin_packet_t *storage)

Callers 1

entity_event_receivedFunction · 0.85

Calls 5

b2bl_parse_keyFunction · 0.85
b2bl_search_tuple_safeFunction · 0.85
bin_pop_intFunction · 0.85
get_ticksFunction · 0.85
unpack_context_valsFunction · 0.85

Tested by

no test coverage detected