Browse code

presence: more verbose debug message when failing to delete item from memory

- re-ordered comparison expression to check first lengths

Daniel-Constantin Mierla authored on 02/01/2015 12:41:44
Showing 2 changed files
... ...
@@ -287,12 +287,12 @@ int delete_shtable(shtable_t htable,unsigned int hash_code,subs_t* subs)
287 287
 		
288 288
 	while(s)
289 289
 	{
290
-		if(s->callid.len==subs->callid.len &&
291
-				strncmp(s->callid.s, subs->callid.s, subs->callid.len)==0 &&
292
-			s->to_tag.len== subs->to_tag.len &&
293
-				strncmp(s->to_tag.s, subs->to_tag.s, subs->to_tag.len)==0 &&
294
-			s->from_tag.len== subs->from_tag.len &&
295
-				strncmp(s->from_tag.s, subs->from_tag.s, subs->from_tag.len)== 0)
290
+		if(s->callid.len==subs->callid.len
291
+				&& s->to_tag.len==subs->to_tag.len
292
+				&& s->from_tag.len==subs->from_tag.len
293
+				&& strncmp(s->callid.s,subs->callid.s,subs->callid.len)==0
294
+				&& strncmp(s->to_tag.s,subs->to_tag.s,subs->to_tag.len)==0
295
+				&& strncmp(s->from_tag.s,subs->from_tag.s,subs->from_tag.len)==0)
296 296
 		{
297 297
 			found= s->local_cseq +1;
298 298
 			ps->next= s->next;
... ...
@@ -457,19 +457,23 @@ void delete_subs(str* pres_uri, str* ev_name, str* to_tag,
457 457
 		str* from_tag, str* callid)
458 458
 {
459 459
 	subs_t subs;
460
+
460 461
 	memset(&subs, 0, sizeof(subs_t));
461
-	
462 462
 	subs.pres_uri = *pres_uri;
463 463
 	subs.from_tag = *from_tag;
464 464
 	subs.to_tag = *to_tag;
465 465
 	subs.callid = *callid;
466
-	
466
+
467 467
 	/* delete record from hash table also if not in dbonly mode */
468 468
 	if(subs_dbmode != DB_ONLY)
469 469
 	{
470 470
 		unsigned int hash_code= core_hash(pres_uri, ev_name, shtable_size);
471
-		if(delete_shtable(subs_htable, hash_code, &subs) < 0)
472
-			LM_ERR("Failed to delete subscription from memory\n");
471
+		if(delete_shtable(subs_htable, hash_code, &subs) < 0) {
472
+			LM_ERR("Failed to delete subscription from memory"
473
+					" [%.*s : %.*s / %.*s / %.*s]\n", ev_name->len, ev_name->s,
474
+					callid->len, callid->s, from_tag->len, from_tag->s,
475
+					to_tag->len, to_tag->s);
476
+		}
473 477
 	}
474 478
 
475 479
 	if(subs_dbmode != NO_DB && delete_db_subs(to_tag, from_tag, callid)< 0)