Bläddra i källkod

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

- re-ordered comparison expression to check first lengths
Daniel-Constantin Mierla 10 år sedan
förälder
incheckning
497777e042
2 ändrade filer med 14 tillägg och 10 borttagningar
  1. 6 6
      modules/presence/hash.c
  2. 8 4
      modules/presence/subscribe.c

+ 6 - 6
modules/presence/hash.c

@@ -287,12 +287,12 @@ int delete_shtable(shtable_t htable,unsigned int hash_code,subs_t* subs)
 		
 	while(s)
 	{
-		if(s->callid.len==subs->callid.len &&
-				strncmp(s->callid.s, subs->callid.s, subs->callid.len)==0 &&
-			s->to_tag.len== subs->to_tag.len &&
-				strncmp(s->to_tag.s, subs->to_tag.s, subs->to_tag.len)==0 &&
-			s->from_tag.len== subs->from_tag.len &&
-				strncmp(s->from_tag.s, subs->from_tag.s, subs->from_tag.len)== 0)
+		if(s->callid.len==subs->callid.len
+				&& s->to_tag.len==subs->to_tag.len
+				&& s->from_tag.len==subs->from_tag.len
+				&& strncmp(s->callid.s,subs->callid.s,subs->callid.len)==0
+				&& strncmp(s->to_tag.s,subs->to_tag.s,subs->to_tag.len)==0
+				&& strncmp(s->from_tag.s,subs->from_tag.s,subs->from_tag.len)==0)
 		{
 			found= s->local_cseq +1;
 			ps->next= s->next;

+ 8 - 4
modules/presence/subscribe.c

@@ -457,19 +457,23 @@ void delete_subs(str* pres_uri, str* ev_name, str* to_tag,
 		str* from_tag, str* callid)
 {
 	subs_t subs;
+
 	memset(&subs, 0, sizeof(subs_t));
-	
 	subs.pres_uri = *pres_uri;
 	subs.from_tag = *from_tag;
 	subs.to_tag = *to_tag;
 	subs.callid = *callid;
-	
+
 	/* delete record from hash table also if not in dbonly mode */
 	if(subs_dbmode != DB_ONLY)
 	{
 		unsigned int hash_code= core_hash(pres_uri, ev_name, shtable_size);
-		if(delete_shtable(subs_htable, hash_code, &subs) < 0)
-			LM_ERR("Failed to delete subscription from memory\n");
+		if(delete_shtable(subs_htable, hash_code, &subs) < 0) {
+			LM_ERR("Failed to delete subscription from memory"
+					" [%.*s : %.*s / %.*s / %.*s]\n", ev_name->len, ev_name->s,
+					callid->len, callid->s, from_tag->len, from_tag->s,
+					to_tag->len, to_tag->s);
+		}
 	}
 
 	if(subs_dbmode != NO_DB && delete_db_subs(to_tag, from_tag, callid)< 0)