Browse code

ims_usrloc_scscf: added '\n' for debug messages

- added a new line to the end of some debug logs for
better formatting.

Aleksandar Yosifov authored on 04/11/2019 11:51:07
Showing 2 changed files
... ...
@@ -70,32 +70,32 @@ int get_subscriber(impurecord_t* urec, str *presentity_uri, str *watcher_contact
70 70
     reg_subscriber* s = NULL;
71 71
 
72 72
     if (!watcher_contact || !presentity_uri) {
73
-        LM_DBG("no valid presentity_uri/watcher contact pair");
73
+        LM_DBG("no valid presentity_uri/watcher contact pair\n");
74 74
         return 0;
75 75
     }
76 76
 
77 77
     if (!urec) {
78
-        LM_WARN("No impurecord passed.... ignoring");
78
+        LM_WARN("No impurecord passed.... ignoring\n");
79 79
         return 1;
80 80
     }
81 81
 
82
-    LM_DBG("Getting existing subscription to reg if it exists for watcher contact <%.*s> and presentity uri <%.*s>", watcher_contact->len, watcher_contact->s,
82
+    LM_DBG("Getting existing subscription to reg if it exists for watcher contact <%.*s> and presentity uri <%.*s>\n", watcher_contact->len, watcher_contact->s,
83 83
             presentity_uri->len, presentity_uri->s);
84 84
 
85 85
     s = urec->shead;
86 86
     while (s) {
87
-        LM_DBG("Scrolling through subscription to reg events in IMPU record list");
87
+        LM_DBG("Scrolling through subscription to reg events in IMPU record list\n");
88 88
         if (s->event == event &&
89 89
                 (s->watcher_contact.len == watcher_contact->len)
90 90
                 && (strncasecmp(s->watcher_contact.s, watcher_contact->s, watcher_contact->len) == 0)
91 91
                 && (strncasecmp(s->presentity_uri.s, presentity_uri->s, presentity_uri->len) == 0)) {
92
-            LM_DBG("Found subscription for watcher contact  <%.*s> and presentity_uri <%.*s>", watcher_contact->len, watcher_contact->s, presentity_uri->len, presentity_uri->s);
92
+            LM_DBG("Found subscription for watcher contact  <%.*s> and presentity_uri <%.*s>\n", watcher_contact->len, watcher_contact->s, presentity_uri->len, presentity_uri->s);
93 93
             *r_subscriber = s;
94 94
             return 0;
95 95
         }
96 96
         s = s->next;
97 97
     }
98
-    LM_DBG("Did not find subscription for watcher contact  <%.*s> and presentity_uri <%.*s>", watcher_contact->len, watcher_contact->s, presentity_uri->len, presentity_uri->s);
98
+    LM_DBG("Did not find subscription for watcher contact  <%.*s> and presentity_uri <%.*s>\n", watcher_contact->len, watcher_contact->s, presentity_uri->len, presentity_uri->s);
99 99
     
100 100
     return 1;
101 101
 }
... ...
@@ -115,7 +115,7 @@ reg_subscriber* new_subscriber(subscriber_data_t* subscriber_data) {
115 115
             + subscriber_data->watcher_contact->len + subscriber_data->watcher_uri->len + subscriber_data->presentity_uri->len
116 116
             + subscriber_data->record_route->len + subscriber_data->sockinfo_str->len;
117 117
 
118
-    LM_DBG("Creating new subscription to reg");
118
+    LM_DBG("Creating new subscription to reg\n");
119 119
 
120 120
     s = (reg_subscriber*) shm_malloc(len);
121 121
     if (s == 0) {
... ...
@@ -192,7 +192,7 @@ reg_subscriber* new_subscriber(subscriber_data_t* subscriber_data) {
192 192
     
193 193
     hash_code = core_hash(&subs.callid, &subs.to_tag, sub_dialog_hash_size);
194 194
     
195
-    LM_DBG("Adding sub dialog hash info with call_id: <%.*s> and ttag <%.*s> amd ftag <%.*s> and hash code <%d>", subs.callid.len, subs.callid.s, subs.to_tag.len, subs.to_tag.s, subs.from_tag.len,  subs.from_tag.s, hash_code);
195
+    LM_DBG("Adding sub dialog hash info with call_id: <%.*s> and ttag <%.*s> amd ftag <%.*s> and hash code <%d>\n", subs.callid.len, subs.callid.s, subs.to_tag.len, subs.to_tag.s, subs.from_tag.len,  subs.from_tag.s, hash_code);
196 196
     
197 197
     if (pres_insert_shtable(sub_dialog_table, hash_code, &subs))
198 198
     {
... ...
@@ -213,7 +213,7 @@ str get_presentity_from_subscriber_dialog(str *callid, str *to_tag, str *from_ta
213 213
     hash_code = core_hash(callid, to_tag, sub_dialog_hash_size);
214 214
     /* search the record in hash table */
215 215
     lock_get(&sub_dialog_table[hash_code].lock);
216
-    LM_DBG("Searching sub dialog hash info with call_id: <%.*s> and ttag <%.*s> and ftag <%.*s> and hash code <%d>", callid->len, callid->s, to_tag->len, to_tag->s, from_tag->len, from_tag->s, hash_code);
216
+    LM_DBG("Searching sub dialog hash info with call_id: <%.*s> and ttag <%.*s> and ftag <%.*s> and hash code <%d>\n", callid->len, callid->s, to_tag->len, to_tag->s, from_tag->len, from_tag->s, hash_code);
217 217
     s = pres_search_shtable(sub_dialog_table, *callid, *to_tag, *from_tag, hash_code);
218 218
     if(s== NULL)
219 219
     {
... ...
@@ -233,7 +233,7 @@ str get_presentity_from_subscriber_dialog(str *callid, str *to_tag, str *from_ta
233 233
     
234 234
     lock_release(&sub_dialog_table[hash_code].lock);
235 235
     
236
-    LM_DBG("Found subscriber dialog record in hash table with pres_uri: [%.*s]", pres_uri.len, pres_uri.s);
236
+    LM_DBG("Found subscriber dialog record in hash table with pres_uri: [%.*s]\n", pres_uri.len, pres_uri.s);
237 237
     return pres_uri;
238 238
 }
239 239
 
... ...
@@ -244,7 +244,7 @@ int add_subscriber(impurecord_t* urec,
244 244
     reg_subscriber *s, *previous_s;
245 245
 	reg_subscriber *first_s = 0;
246 246
 	int subscribe_count = 0;
247
-    LM_DBG("Adding reg subscription to IMPU record");
247
+    LM_DBG("Adding reg subscription to IMPU record\n");
248 248
 
249 249
     if (!urec) {
250 250
         LM_ERR("no presentity impu record provided\n");
... ...
@@ -252,21 +252,21 @@ int add_subscriber(impurecord_t* urec,
252 252
     }
253 253
     
254 254
 	if (max_subscribes > 0) {
255
-		LM_DBG("Maximum subscribers per watcher_uri, presentity_uri, event combination is <%d>", max_subscribes);
255
+		LM_DBG("Maximum subscribers per watcher_uri, presentity_uri, event combination is <%d>\n", max_subscribes);
256 256
 		previous_s = urec->shead;
257 257
 		while (previous_s) {
258
-				LM_DBG("Scrolling through subscription to reg events in IMPU record list");
258
+				LM_DBG("Scrolling through subscription to reg events in IMPU record list\n");
259 259
 				if (previous_s->event == subscriber_data->event &&
260 260
 						(previous_s->watcher_uri.len == subscriber_data->watcher_uri->len)
261 261
 						&& (strncasecmp(previous_s->watcher_uri.s, subscriber_data->watcher_uri->s, subscriber_data->watcher_uri->len) == 0)
262 262
 						&& (strncasecmp(previous_s->presentity_uri.s, subscriber_data->presentity_uri->s, subscriber_data->presentity_uri->len) == 0)) {
263
-						LM_DBG("Found existing subscription for watcher_uri <%.*s>, presentity_uri <%.*s>, event <%d>",
263
+						LM_DBG("Found existing subscription for watcher_uri <%.*s>, presentity_uri <%.*s>, event <%d>\n",
264 264
 								subscriber_data->watcher_uri->len, subscriber_data->watcher_uri->s,
265 265
 								subscriber_data->presentity_uri->len, subscriber_data->presentity_uri->s,
266 266
 								subscriber_data->event);
267 267
 						subscribe_count++;
268 268
 						if (first_s == 0) {
269
-						    LM_DBG("This is the first subscription with the same watcher uri, presentity uri, event combination - we store it in case we need to remove the first, oldest subscription");
269
+						    LM_DBG("This is the first subscription with the same watcher uri, presentity uri, event combination - we store it in case we need to remove the first, oldest subscription\n");
270 270
 							first_s = previous_s;	
271 271
 						}
272 272
 
... ...
@@ -275,7 +275,7 @@ int add_subscriber(impurecord_t* urec,
275 275
 				previous_s = previous_s->next;
276 276
 		}
277 277
 		if (subscribe_count >= max_subscribes) {
278
-				LM_DBG("There are currently more subscribes for this watcher_uri, presentity_uri, event combination  <%d> than the maximum - so we remove the first and oldest one",
278
+				LM_DBG("There are currently more subscribes for this watcher_uri, presentity_uri, event combination  <%d> than the maximum - so we remove the first and oldest one\n",
279 279
 						subscribe_count);
280 280
 				//we remove the first, oldest subscription
281 281
 				delete_subscriber (urec, first_s);
... ...
@@ -288,7 +288,7 @@ int add_subscriber(impurecord_t* urec,
288 288
 
289 289
     if (!s) return -1;
290 290
 
291
-    LM_DBG("Adding new subscription to IMPU record list");
291
+    LM_DBG("Adding new subscription to IMPU record list\n");
292 292
     s->next = 0;
293 293
     s->prev = urec->stail;
294 294
     if (urec->stail) urec->stail->next = s;
... ...
@@ -350,7 +350,7 @@ int update_subscriber(impurecord_t* urec, reg_subscriber** _reg_subscriber, int
350 350
     
351 351
     hash_code = core_hash(&subs.callid, &subs.to_tag, sub_dialog_hash_size);
352 352
     
353
-    LM_DBG("Updating sub dialog hash info with call_id: <%.*s> and ttag <%.*s> amd ftag <%.*s> and hash code <%d>", subs.callid.len, subs.callid.s, subs.to_tag.len, subs.to_tag.s, subs.from_tag.len,  subs.from_tag.s, hash_code);
353
+    LM_DBG("Updating sub dialog hash info with call_id: <%.*s> and ttag <%.*s> amd ftag <%.*s> and hash code <%d>\n", subs.callid.len, subs.callid.s, subs.to_tag.len, subs.to_tag.s, subs.from_tag.len,  subs.from_tag.s, hash_code);
354 354
     
355 355
     if (pres_update_shtable(sub_dialog_table, hash_code, &subs, REMOTE_TYPE))
356 356
     {
... ...
@@ -369,10 +369,10 @@ int update_subscriber(impurecord_t* urec, reg_subscriber** _reg_subscriber, int
369 369
 
370 370
 
371 371
 void external_delete_subscriber(reg_subscriber *s, udomain_t* _t, int lock_domain) {
372
-    LM_DBG("Deleting subscriber");
372
+    LM_DBG("Deleting subscriber\n");
373 373
     impurecord_t* urec;
374 374
    
375
-    LM_DBG("Updating reg subscription in IMPU record");
375
+    LM_DBG("Updating reg subscription in IMPU record\n");
376 376
 
377 377
     if(lock_domain) lock_udomain(_t, &s->presentity_uri);
378 378
     int res = get_impurecord(_t, &s->presentity_uri, &urec);
... ...
@@ -388,7 +388,7 @@ void external_delete_subscriber(reg_subscriber *s, udomain_t* _t, int lock_domai
388 388
 }
389 389
 
390 390
 void delete_subscriber(impurecord_t* urec, reg_subscriber *s) {
391
-    LM_DBG("Deleting subscriber [%.*s], watcher_contact [%.*s] from IMPU: [%.*s]", 
391
+    LM_DBG("Deleting subscriber [%.*s], watcher_contact [%.*s] from IMPU: [%.*s]\n", 
392 392
 			s->watcher_uri.len, s->watcher_uri.s, s->watcher_contact.len, s->watcher_contact.s, urec->public_identity.len, urec->public_identity.s);
393 393
     
394 394
     if (db_mode == WRITE_THROUGH && db_unlink_subscriber_from_impu(urec, s) !=0) {
... ...
@@ -404,7 +404,7 @@ void delete_subscriber(impurecord_t* urec, reg_subscriber *s) {
404 404
     else s->prev->next = s->next;
405 405
     if (urec->stail == s) urec->stail = s->prev;
406 406
     else s->next->prev = s->prev;
407
-    LM_DBG("About to free subscriber memory");
407
+    LM_DBG("About to free subscriber memory\n");
408 408
     free_subscriber(s);
409 409
 }
410 410
 
... ...
@@ -413,7 +413,7 @@ void free_subscriber(reg_subscriber *s) {
413 413
     unsigned int hash_code=0;
414 414
     subs_t subs;
415 415
     
416
-    LM_DBG("Freeing subscriber memory");
416
+    LM_DBG("Freeing subscriber memory\n");
417 417
     
418 418
     memset(&subs, 0, sizeof(subs_t));
419 419
     
... ...
@@ -425,7 +425,7 @@ void free_subscriber(reg_subscriber *s) {
425 425
     /* delete from cache table */
426 426
     hash_code= core_hash(&s->call_id, &s->to_tag, sub_dialog_hash_size);
427 427
     
428
-    LM_DBG("Removing sub dialog hash info with call_id: <%.*s> and ttag <%.*s> and ftag <%.*s> and hash code <%d>", s->call_id.len, s->call_id.s, s->to_tag.len, s->to_tag.s, s->from_tag.len, s->from_tag.s, hash_code);
428
+    LM_DBG("Removing sub dialog hash info with call_id: <%.*s> and ttag <%.*s> and ftag <%.*s> and hash code <%d>\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, hash_code);
429 429
     if(pres_delete_shtable(sub_dialog_table,hash_code, &subs)< 0)
430 430
     {
431 431
 	    LM_ERR("record not found in hash table\n");
... ...
@@ -306,7 +306,7 @@ void mem_timer_udomain(udomain_t* _d, int istart, int istep) {
306 306
                 if ((contact_ptr->expires-now) <= 0) {
307 307
                     if (contact_ptr->state == CONTACT_DELAYED_DELETE) {
308 308
                         if (contact_ptr->ref_count <= 0) {
309
-                            LM_DBG("contact in state CONTACT_DELATED_DELETE is about to be deleted");
309
+                            LM_DBG("contact in state CONTACT_DELATED_DELETE is about to be deleted\n");
310 310
                             expired_contacts[num_expired_contacts] = contact_ptr;
311 311
                             num_expired_contacts++;
312 312
                         } else {
... ...
@@ -320,12 +320,12 @@ void mem_timer_udomain(udomain_t* _d, int istart, int istep) {
320 320
 								if (ref_count_db < 0) {
321 321
 									LM_ERR("Unable to check if contact is unlinked\n");
322 322
 								} else if (ref_count_db == 0) {
323
-									LM_DBG("Contact has ref count [%d] but there's no link on the DB. Deleting contact", contact_ptr->ref_count);
323
+									LM_DBG("Contact has ref count [%d] but there's no link on the DB. Deleting contact\n", contact_ptr->ref_count);
324 324
 									contact_ptr->ref_count = 0;
325 325
 									expired_contacts[num_expired_contacts] = contact_ptr;
326 326
 									num_expired_contacts++;
327 327
 								} else {
328
-									LM_DBG("Contact in state CONTACT_DELAYED_DELETE has ref count [%d] on DB", ref_count_db);
328
+									LM_DBG("Contact in state CONTACT_DELAYED_DELETE has ref count [%d] on DB\n", ref_count_db);
329 329
 								}
330 330
 							} else {
331 331
 								LM_DBG("contact in state CONTACT_DELAYED_DELETE still has a ref count of [%d] in memory. Not doing anything for now \n", contact_ptr->ref_count);