Skip to content

Commit

Permalink
ims_usrloc_scscf: extend and fix log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyosifov authored and henningw committed May 7, 2020
1 parent d35e976 commit b2487d9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
22 changes: 11 additions & 11 deletions src/modules/ims_usrloc_scscf/impurecord.c
Expand Up @@ -385,8 +385,8 @@ static inline void process_impurecord(impurecord_t* _r) {
s->watcher_contact.len, s->watcher_contact.s, s->presentity_uri.len, s->presentity_uri.s,
(unsigned int) (s->expires - time(NULL)));
sl = core_hash(&s->call_id, &s->to_tag, sub_dialog_hash_size);
LM_DBG("Hash size: <%i>", sub_dialog_hash_size);
LM_DBG("Searching sub dialog hash info with call_id: <%.*s> and ttag <%.*s> ftag <%.*s> and hash code <%i>", s->call_id.len, s->call_id.s, s->to_tag.len, s->to_tag.s, s->from_tag.len, s->from_tag.s, sl);
LM_DBG("Hash size: <%i>\n", sub_dialog_hash_size);
LM_DBG("Searching sub dialog hash info with call_id: <%.*s> and ttag <%.*s> ftag <%.*s> and hash code <%i>\n", s->call_id.len, s->call_id.s, s->to_tag.len, s->to_tag.s, s->from_tag.len, s->from_tag.s, sl);
/* search the record in hash table */
lock_get(&sub_dialog_table[sl].lock);
sub_dialog = pres_search_shtable(sub_dialog_table, s->call_id, s->to_tag, s->from_tag, sl);
Expand Down Expand Up @@ -433,7 +433,7 @@ static inline void process_impurecord(impurecord_t* _r) {
mustdeleteimpu = 0;
hascontacts = 1;
} else {
LM_WARN("Bogus state for contact [%.*s] - state: %d... ignoring", ptr->c.len, ptr->c.s, ptr->state);
LM_WARN("Bogus state for contact [%.*s] - state: %d... ignoring\n", ptr->c.len, ptr->c.s, ptr->state);
mustdeleteimpu = 0;
hascontacts = 1;
}
Expand Down Expand Up @@ -567,7 +567,7 @@ int insert_scontact(impurecord_t* _r, str* _contact, ucontact_info_t* _ci, ucont

// /*DB?*/
if (db_mode == WRITE_THROUGH && db_insert_ucontact(_r, *_c) != 0) {
LM_ERR("error inserting contact into db");
LM_ERR("error inserting contact into db\n");
return -1;
}

Expand Down Expand Up @@ -931,7 +931,7 @@ int update_impurecord(struct udomain* _d, str* public_identity, impurecord_t* im

//make usre we have IMPU or enough data to find it...
if (!impu_rec && (!public_identity || !public_identity->len || !public_identity->s)) {
LM_WARN("can't call update_impurecord with no details of IMPU..n");
LM_WARN("can't call update_impurecord with no details of IMPU..\n");
return -1;
}

Expand Down Expand Up @@ -1040,7 +1040,7 @@ int update_impurecord(struct udomain* _d, str* public_identity, impurecord_t* im
ref_subscription_unsafe(subs_ptr);
(*_r)->s = subs_ptr;
} else {
LM_DBG("new subscription is the same as the old one....not doing anything");
LM_DBG("new subscription is the same as the old one....not doing anything\n");
//check that the service profile and associated impus are in the subscription, if not, add...
/* if (compare_subscription(subs_ptr, *s) != 0) {
unref_subscription((*_r)->s); //different subscription which we don't have lock on yet.
Expand All @@ -1053,7 +1053,7 @@ int update_impurecord(struct udomain* _d, str* public_identity, impurecord_t* im
run_ul_callbacks((*_r)->cbs, UL_IMPU_UPDATE, *_r, NULL);

if (db_mode == WRITE_THROUGH && db_insert_impurecord(_d, &(*_r)->public_identity, (*_r)->reg_state, (*_r)->barring, &(*_r)->s, &(*_r)->ccf1, &(*_r)->ccf2, &(*_r)->ecf1, &(*_r)->ecf2, _r) != 0) {
LM_ERR("error inserting IMPU [%.*s] into db... continuing", (*_r)->public_identity.len, (*_r)->public_identity.s);
LM_ERR("error inserting IMPU [%.*s] into db... continuing\n", (*_r)->public_identity.len, (*_r)->public_identity.s);
}

if (subscription_locked) {
Expand Down Expand Up @@ -1142,7 +1142,7 @@ int link_contact_to_impu(impurecord_t* impu, ucontact_t* contact, int write_to_d
impu_contact_ptr = impu->linked_contacts.head;
while (impu_contact_ptr) {
if (impu_contact_ptr->contact->is_3gpp) {
LM_DBG("Found first 3GPP contact");
LM_DBG("Found first 3GPP contact\n");
break;
}
impu_contact_ptr = impu_contact_ptr->next;
Expand All @@ -1169,7 +1169,7 @@ int link_contact_to_impu(impurecord_t* impu, ucontact_t* contact, int write_to_d
//a housekeeper thread do it
locked = 1;
} else {
LM_ERR("Could not get lock to remove link from of contact from impu....");
LM_ERR("Could not get lock to remove link from of contact from impu...\n");
//TODO: we either need to wait and retry or we need to get another process to do this for us.... right now we will leak a contact.
}
if (locked == 1) {
Expand Down Expand Up @@ -1205,7 +1205,7 @@ int link_contact_to_impu(impurecord_t* impu, ucontact_t* contact, int write_to_d
//a housekeeper thread do it
locked = 1;
} else {
LM_ERR("Could not get lock to remove link from of contact from impu....");
LM_ERR("Could not get lock to remove link from of contact from impu...\n");
//TODO: we either need to wait and retry or we need to get another process to do this for us.... right now we will leak a contact.
}
if (locked == 1) {
Expand Down Expand Up @@ -1253,7 +1253,7 @@ int unlink_contact_from_impu(impurecord_t* impu, ucontact_t* contact, int write_
//a housekeeper thread do it
locked = 1;
} else {
LM_ERR("Could not get lock to remove link from of contact from impu....");
LM_ERR("Could not get lock to remove link from of contact from impu...\n");
//TODO: we either need to wait and retry or we need to get another process to do this for us.... right now we will leak a contact.
}
if (locked == 1) {
Expand Down
4 changes: 3 additions & 1 deletion src/modules/ims_usrloc_scscf/subscribe.c
Expand Up @@ -288,7 +288,9 @@ int add_subscriber(impurecord_t* urec,

if (!s) return -1;

LM_DBG("Adding new subscription to IMPU record list\n");
LM_DBG("Adding new subscription p-uri[%.*s] w-contact[%.*s] to IMPU record [%.*s] list\n",
s->presentity_uri.len, s->presentity_uri.s, s->watcher_contact.len, s->watcher_contact.s, urec->public_identity.len, urec->public_identity.s);

s->next = 0;
s->prev = urec->stail;
if (urec->stail) urec->stail->next = s;
Expand Down
11 changes: 7 additions & 4 deletions src/modules/ims_usrloc_scscf/udomain.c
Expand Up @@ -332,7 +332,8 @@ void mem_timer_udomain(udomain_t* _d, int istart, int istep) {
}
}
} else if (contact_ptr->state != CONTACT_DELETED) {
LM_DBG("expiring contact [%.*s].... setting to CONTACT_EXPIRE_PENDING_NOTIFY\n", contact_ptr->aor.len, contact_ptr->aor.s);
LM_DBG("expiring contact [%.*s](%.*s).... setting to CONTACT_EXPIRE_PENDING_NOTIFY\n",
contact_ptr->aor.len, contact_ptr->aor.s, contact_ptr->c.len, contact_ptr->c.s);
contact_ptr->state = CONTACT_EXPIRE_PENDING_NOTIFY;
ref_contact_unsafe(contact_ptr);
expired_contacts[num_expired_contacts] = contact_ptr;
Expand Down Expand Up @@ -399,11 +400,13 @@ void mem_timer_udomain(udomain_t* _d, int istart, int istep) {
slot = expired_contacts[i]->sl;
lock_contact_slot_i(slot);
if (expired_contacts[i]->state != CONTACT_DELAYED_DELETE) {
LM_DBG("Setting contact state to CONTACT_DELETED for contact [%.*s]\n", expired_contacts[i]->aor.len, expired_contacts[i]->aor.s);
LM_DBG("Setting contact state to CONTACT_DELETED for contact [%.*s](%.*s)\n",
expired_contacts[i]->aor.len, expired_contacts[i]->aor.s, expired_contacts[i]->c.len, expired_contacts[i]->c.s);
expired_contacts[i]->state = CONTACT_DELETED;
unref_contact_unsafe(expired_contacts[i]);
} else {
LM_DBG("deleting contact [%.*s]\n", expired_contacts[i]->aor.len, expired_contacts[i]->aor.s);
LM_DBG("deleting contact [%.*s](%.*s)\n",
expired_contacts[i]->aor.len, expired_contacts[i]->aor.s, expired_contacts[i]->c.len, expired_contacts[i]->c.s);
delete_scontact(expired_contacts[i]);
}
unlock_contact_slot_i(slot);
Expand Down Expand Up @@ -577,7 +580,7 @@ int insert_impurecord(struct udomain* _d, str* public_identity, str* private_ide

/*DB?*/
if (db_mode == WRITE_THROUGH && db_insert_impurecord(_d, public_identity, reg_state, barring, s, ccf1, ccf2, ecf1, ecf2, _r) != 0) {
LM_ERR("error inserting contact into db");
LM_ERR("error inserting contact into db\n");
goto error;
}

Expand Down

0 comments on commit b2487d9

Please sign in to comment.