Browse code

modules_k/rls: RLS NOTIFY requests now trickled out instead of in one big batch on timeout

- New modparam: notifier_poll_rate (default 10 per second) can be
used to set how often the notifier process should check for work.
Each time the notifier process does something it should send (if
the hash works evenly) 1/(waitn_time * notifier_poll_rate) sets
of RLS NOTIFY requests.
- RLS NOTIFY requests will still come out within waitn_time seconds of
the back-end NOTIFY.
- Corrected the the default value of waitn_time. It is now 5 seconds
which matches the documentation and the RFC.
- Fixed a whitespace/indentation inconsistency and a typo in one of the
diagnostic messages.

Peter Dunkley authored on 30/03/2012 11:48:33
Showing 5 changed files
... ...
@@ -33,19 +33,20 @@ Anca-Maria Vamanu
33 33
               3.8. clean_period (int)
34 34
               3.9. rlpres_clean_period (int)
35 35
               3.10. waitn_time (int)
36
-              3.11. max_expires (int)
37
-              3.12. expires_offset (int)
38
-              3.13. hash_size (int)
39
-              3.14. xcap_root (str)
40
-              3.15. integrated_xcap_server (int)
41
-              3.16. to_presence_code (int)
42
-              3.17. rls_event (str)
43
-              3.18. outbound_proxy (str)
44
-              3.19. server_address (str)
45
-              3.20. max_notify_body_length (int)
46
-              3.21. fetch_rows (integer)
47
-              3.22. disable_remote_presence (integer)
48
-              3.23. max_backend_subs (integer)
36
+              3.11. notifier_poll_rate (int)
37
+              3.12. max_expires (int)
38
+              3.13. expires_offset (int)
39
+              3.14. hash_size (int)
40
+              3.15. xcap_root (str)
41
+              3.16. integrated_xcap_server (int)
42
+              3.17. to_presence_code (int)
43
+              3.18. rls_event (str)
44
+              3.19. outbound_proxy (str)
45
+              3.20. server_address (str)
46
+              3.21. max_notify_body_length (int)
47
+              3.22. fetch_rows (integer)
48
+              3.23. disable_remote_presence (integer)
49
+              3.24. max_backend_subs (integer)
49 50
 
50 51
         4. Functions
51 52
 
... ...
@@ -69,22 +70,23 @@ Anca-Maria Vamanu
69 70
    1.8. Set clean_period parameter
70 71
    1.9. Set rlpres_clean_period parameter
71 72
    1.10. Set waitn_time parameter
72
-   1.11. Set max_expires parameter
73
-   1.12. Set expires_offset parameter
74
-   1.13. Set hash_size parameter
73
+   1.11. Set notifier_poll_rate parameter
74
+   1.12. Set max_expires parameter
75
+   1.13. Set expires_offset parameter
75 76
    1.14. Set hash_size parameter
76
-   1.15. Set integrated_xcap_server parameter
77
-   1.16. Set to_presence_code parameter
78
-   1.17. Set rls_event parameter
79
-   1.18. Set outbound_proxy parameter
80
-   1.19. Set server_address parameter
81
-   1.20. Set max_notify_body_length parameter
82
-   1.21. Set fetch_rows parameter
83
-   1.22. Set disable_remote_presence parameter
84
-   1.23. Set max_backend_subs parameter
85
-   1.24. rls_handle_subscribe usage
86
-   1.25. rls_handle_notify usage
87
-   1.26. rls_update_subs usage
77
+   1.15. Set hash_size parameter
78
+   1.16. Set integrated_xcap_server parameter
79
+   1.17. Set to_presence_code parameter
80
+   1.18. Set rls_event parameter
81
+   1.19. Set outbound_proxy parameter
82
+   1.20. Set server_address parameter
83
+   1.21. Set max_notify_body_length parameter
84
+   1.22. Set fetch_rows parameter
85
+   1.23. Set disable_remote_presence parameter
86
+   1.24. Set max_backend_subs parameter
87
+   1.25. rls_handle_subscribe usage
88
+   1.26. rls_handle_notify usage
89
+   1.27. rls_update_subs usage
88 90
 
89 91
 Chapter 1. Admin Guide
90 92
 
... ...
@@ -108,19 +110,20 @@ Chapter 1. Admin Guide
108 110
         3.8. clean_period (int)
109 111
         3.9. rlpres_clean_period (int)
110 112
         3.10. waitn_time (int)
111
-        3.11. max_expires (int)
112
-        3.12. expires_offset (int)
113
-        3.13. hash_size (int)
114
-        3.14. xcap_root (str)
115
-        3.15. integrated_xcap_server (int)
116
-        3.16. to_presence_code (int)
117
-        3.17. rls_event (str)
118
-        3.18. outbound_proxy (str)
119
-        3.19. server_address (str)
120
-        3.20. max_notify_body_length (int)
121
-        3.21. fetch_rows (integer)
122
-        3.22. disable_remote_presence (integer)
123
-        3.23. max_backend_subs (integer)
113
+        3.11. notifier_poll_rate (int)
114
+        3.12. max_expires (int)
115
+        3.13. expires_offset (int)
116
+        3.14. hash_size (int)
117
+        3.15. xcap_root (str)
118
+        3.16. integrated_xcap_server (int)
119
+        3.17. to_presence_code (int)
120
+        3.18. rls_event (str)
121
+        3.19. outbound_proxy (str)
122
+        3.20. server_address (str)
123
+        3.21. max_notify_body_length (int)
124
+        3.22. fetch_rows (integer)
125
+        3.23. disable_remote_presence (integer)
126
+        3.24. max_backend_subs (integer)
124 127
 
125 128
    4. Functions
126 129
 
... ...
@@ -189,19 +192,20 @@ Chapter 1. Admin Guide
189 192
    3.8. clean_period (int)
190 193
    3.9. rlpres_clean_period (int)
191 194
    3.10. waitn_time (int)
192
-   3.11. max_expires (int)
193
-   3.12. expires_offset (int)
194
-   3.13. hash_size (int)
195
-   3.14. xcap_root (str)
196
-   3.15. integrated_xcap_server (int)
197
-   3.16. to_presence_code (int)
198
-   3.17. rls_event (str)
199
-   3.18. outbound_proxy (str)
200
-   3.19. server_address (str)
201
-   3.20. max_notify_body_length (int)
202
-   3.21. fetch_rows (integer)
203
-   3.22. disable_remote_presence (integer)
204
-   3.23. max_backend_subs (integer)
195
+   3.11. notifier_poll_rate (int)
196
+   3.12. max_expires (int)
197
+   3.13. expires_offset (int)
198
+   3.14. hash_size (int)
199
+   3.15. xcap_root (str)
200
+   3.16. integrated_xcap_server (int)
201
+   3.17. to_presence_code (int)
202
+   3.18. rls_event (str)
203
+   3.19. outbound_proxy (str)
204
+   3.20. server_address (str)
205
+   3.21. max_notify_body_length (int)
206
+   3.22. fetch_rows (integer)
207
+   3.23. disable_remote_presence (integer)
208
+   3.24. max_backend_subs (integer)
205 209
 
206 210
 3.1. db_url(str)
207 211
 
... ...
@@ -325,9 +329,10 @@ modparam("rls", "rlpres_clean_period", 100)
325 329
 
326 330
 3.10. waitn_time (int)
327 331
 
328
-   The timer period at which the server should attempt to send Notifies
329
-   with the updated presence state of the subscribed list or watcher
330
-   information.
332
+   The maximum time period that RLS NOTIFY requests will be buffered for.
333
+   The server will attempt to send NOTIFY requests with the updated
334
+   presence state of the subscribed list or watcher information within
335
+   this many seconds of a change occurring.
331 336
 
332 337
    Default value is “5”.
333 338
 
... ...
@@ -336,18 +341,31 @@ modparam("rls", "rlpres_clean_period", 100)
336 341
 modparam("rls", "waitn_time", 10)
337 342
 ...
338 343
 
339
-3.11. max_expires (int)
344
+3.11. notifier_poll_rate (int)
345
+
346
+   The number of times per second that the notifier process should check
347
+   for work. Approximately 1/(waitn_time * notifier_poll_rate) of the
348
+   pending updates will be sent each time the notifier runs.
349
+
350
+   Default value is “10”.
351
+
352
+   Example 1.11. Set notifier_poll_rate parameter
353
+...
354
+modparam("rls", "notifier_poll_rate", 20)
355
+...
356
+
357
+3.12. max_expires (int)
340 358
 
341 359
    The maximum accepted expires for a subscription to a list.
342 360
 
343 361
    Default value is “7200”.
344 362
 
345
-   Example 1.11. Set max_expires parameter
363
+   Example 1.12. Set max_expires parameter
346 364
 ...
347 365
 modparam("rls", "max_expires", 10800)
348 366
 ...
349 367
 
350
-3.12. expires_offset (int)
368
+3.13. expires_offset (int)
351 369
 
352 370
    This paramater only has an effect when the db_mode is DB_ONLY (mode 2).
353 371
    When expired subscribers are checked for deletion from the database,
... ...
@@ -360,12 +378,12 @@ modparam("rls", "max_expires", 10800)
360 378
 
361 379
    Default value is “0”.
362 380
 
363
-   Example 1.12. Set expires_offset parameter
381
+   Example 1.13. Set expires_offset parameter
364 382
 ...
365 383
 modparam("rls", "expires_offset", 0)
366 384
 ...
367 385
 
368
-3.13. hash_size (int)
386
+3.14. hash_size (int)
369 387
 
370 388
    The dimension of the hash table used to store subscription to a list.
371 389
    This parameter will be used as the power of 2 when computing table
... ...
@@ -373,35 +391,35 @@ modparam("rls", "expires_offset", 0)
373 391
 
374 392
    Default value is “9 (512)”.
375 393
 
376
-   Example 1.13. Set hash_size parameter
394
+   Example 1.14. Set hash_size parameter
377 395
 ...
378 396
 modparam("rls", "hash_size", 11)
379 397
 ...
380 398
 
381
-3.14. xcap_root (str)
399
+3.15. xcap_root (str)
382 400
 
383 401
    The address of the xcap server.
384 402
 
385 403
    Default value is “NULL”.
386 404
 
387
-   Example 1.14. Set hash_size parameter
405
+   Example 1.15. Set hash_size parameter
388 406
 ...
389 407
 modparam("rls", "xcap_root", "http://192.168.2.132/xcap-root:800")
390 408
 ...
391 409
 
392
-3.15. integrated_xcap_server (int)
410
+3.16. integrated_xcap_server (int)
393 411
 
394 412
    This parameter should be set if only integrated xcap servers are used
395 413
    to store resource lists.
396 414
 
397 415
    Default value is “0”.
398 416
 
399
-   Example 1.15. Set integrated_xcap_server parameter
417
+   Example 1.16. Set integrated_xcap_server parameter
400 418
 ...
401 419
 modparam("rls", "integrated_xcap_server", 1)
402 420
 ...
403 421
 
404
-3.16. to_presence_code (int)
422
+3.17. to_presence_code (int)
405 423
 
406 424
    The code to be returned by rls_handle_subscribe function if the
407 425
    processed Subscribe is not a resource list Subscribe. This code can be
... ...
@@ -411,12 +429,12 @@ modparam("rls", "integrated_xcap_server", 1)
411 429
 
412 430
    Default value is “0”.
413 431
 
414
-   Example 1.16. Set to_presence_code parameter
432
+   Example 1.17. Set to_presence_code parameter
415 433
 ...
416 434
 modparam("rls", "to_presence_code", 10)
417 435
 ...
418 436
 
419
-3.17. rls_event (str)
437
+3.18. rls_event (str)
420 438
 
421 439
    The default event that RLS handles is presence. If some other events
422 440
    should also be handled by RLS they should be added using this
... ...
@@ -424,57 +442,57 @@ modparam("rls", "to_presence_code", 10)
424 442
 
425 443
    Default value is “"presence"”.
426 444
 
427
-   Example 1.17. Set rls_event parameter
445
+   Example 1.18. Set rls_event parameter
428 446
 ...
429 447
 modparam("rls", "rls_event", "dialog;sla")
430 448
 ...
431 449
 
432
-3.18. outbound_proxy (str)
450
+3.19. outbound_proxy (str)
433 451
 
434 452
    The SIP address where to send RLS subscriptions (outbound proxy address
435 453
    as SIP URI).
436 454
 
437 455
    Default value is “NULL”.
438 456
 
439
-   Example 1.18. Set outbound_proxy parameter
457
+   Example 1.19. Set outbound_proxy parameter
440 458
 ...
441 459
 modparam("rls", "outbound_proxy", "sip:presence.kamailio.org")
442 460
 ...
443 461
 
444
-3.19. server_address (str)
462
+3.20. server_address (str)
445 463
 
446 464
    The address of the server that will be used as a contact in sent
447 465
    Subscribe requests and 200 OK replies for Subscribe requests for RLS.
448 466
    It is a mandatory parameter.
449 467
 
450
-   Example 1.19. Set server_address parameter
468
+   Example 1.20. Set server_address parameter
451 469
 ...
452 470
 modparam("rls", "server_address", "sip:rls@ip.address.ofyour.proxy:5060")
453 471
 ...
454 472
 
455
-3.20. max_notify_body_length (int)
473
+3.21. max_notify_body_length (int)
456 474
 
457 475
    The maximum size that the body of a NOTIFY message may be. If set to 0
458 476
    (the default), no size limit is applied. Note that this refers only to
459 477
    the body, not the complete NOTIFY message.
460 478
 
461
-   Example 1.20. Set max_notify_body_length parameter
479
+   Example 1.21. Set max_notify_body_length parameter
462 480
 ...
463 481
 modparam("rls", "max_notify_body_length", 32000)
464 482
 ...
465 483
 
466
-3.21. fetch_rows (integer)
484
+3.22. fetch_rows (integer)
467 485
 
468 486
    Number of rows to be loaded in one step from database.
469 487
 
470 488
    Default value is 500.
471 489
 
472
-   Example 1.21. Set fetch_rows parameter
490
+   Example 1.22. Set fetch_rows parameter
473 491
 ...
474 492
 modparam("rls", "fetch_rows", 1000)
475 493
 ...
476 494
 
477
-3.22. disable_remote_presence (integer)
495
+3.23. disable_remote_presence (integer)
478 496
 
479 497
    When set to a non-zero value RLS will not perform back-end SUBSCRIBEs
480 498
    to non-local presentities. When people have large contact lists RLS
... ...
@@ -487,12 +505,12 @@ modparam("rls", "fetch_rows", 1000)
487 505
 
488 506
    Default value is 0
489 507
 
490
-   Example 1.22. Set disable_remote_presence parameter
508
+   Example 1.23. Set disable_remote_presence parameter
491 509
 ...
492 510
 modparam("rls", "disable_remote_presence", 1)
493 511
 ...
494 512
 
495
-3.23. max_backend_subs (integer)
513
+3.24. max_backend_subs (integer)
496 514
 
497 515
    When set to a non-zero value RLS will limit the number of back-end
498 516
    SUBSCRIBEs for each RLS SUBSCRIBE to this value. Leaving this at the
... ...
@@ -503,7 +521,7 @@ modparam("rls", "disable_remote_presence", 1)
503 521
 
504 522
    Default value is 0
505 523
 
506
-   Example 1.23. Set max_backend_subs parameter
524
+   Example 1.24. Set max_backend_subs parameter
507 525
 ...
508 526
 modparam("rls", "max_backend_subs", 30)
509 527
 ...
... ...
@@ -523,7 +541,7 @@ modparam("rls", "max_backend_subs", 30)
523 541
 
524 542
    This function can be used from REQUEST_ROUTE.
525 543
 
526
-   Example 1.24. rls_handle_subscribe usage
544
+   Example 1.25. rls_handle_subscribe usage
527 545
 ...
528 546
 For presence and rls on the same machine:
529 547
         modparam("rls", "to_presence_code", 10)
... ...
@@ -551,7 +569,7 @@ For rls only:
551 569
 
552 570
    This function can be used from REQUEST_ROUTE.
553 571
 
554
-   Example 1.25. rls_handle_notify usage
572
+   Example 1.26. rls_handle_notify usage
555 573
 ...
556 574
 if(method=="NOTIFY")
557 575
     rls_handle_notify();
... ...
@@ -570,7 +588,7 @@ if(method=="NOTIFY")
570 588
 
571 589
    This function can be used from ANY_ROUTE.
572 590
 
573
-   Example 1.26. rls_update_subs usage
591
+   Example 1.27. rls_update_subs usage
574 592
 ...
575 593
 Within event_route[xhttp:request]:
576 594
         case "PUT":
... ...
@@ -296,9 +296,11 @@ modparam("rls", "rlpres_clean_period", 100)
296 296
 	<section>
297 297
 		<title><varname>waitn_time</varname> (int)</title>
298 298
 		<para>
299
-	 The timer period at which the server should attempt to send
300
-	 Notifies with the updated presence state of the subscribed list
301
-	 or watcher information.
299
+		The maximum time period that RLS NOTIFY requests will
300
+		be buffered for.  The server will attempt to send
301
+		NOTIFY requests with the updated presence state of the
302
+		subscribed list or watcher information within this
303
+		many seconds of a change occurring.
302 304
 		</para>
303 305
 		<para>
304 306
 		<emphasis>Default value is <quote>5</quote>.
... ...
@@ -314,6 +316,28 @@ modparam("rls", "waitn_time", 10)
314 316
 		</example>
315 317
 	</section>
316 318
 
319
+	<section>
320
+		<title><varname>notifier_poll_rate</varname> (int)</title>
321
+		<para>
322
+		The number of times per second that the notifier process
323
+		should check for work.  Approximately
324
+		1/(waitn_time * notifier_poll_rate) of the pending updates
325
+		will be sent each time the notifier runs.
326
+		</para>
327
+		<para>
328
+		<emphasis>Default value is <quote>10</quote>.
329
+		</emphasis>
330
+		</para>
331
+		<example>
332
+		<title>Set <varname>notifier_poll_rate</varname> parameter</title>
333
+		<programlisting format="linespecific">
334
+...
335
+modparam("rls", "notifier_poll_rate", 20)
336
+...
337
+</programlisting>
338
+		</example>
339
+	</section>
340
+
317 341
 	<section>
318 342
 		<title><varname>max_expires</varname> (int)</title>
319 343
 		<para>
... ...
@@ -703,7 +703,9 @@ int rls_handle_notify(struct sip_msg* msg, char* c1, char* c2)
703 703
 	query_cols[n_query_cols]= &str_updated_col;
704 704
 	query_vals[n_query_cols].type = DB1_INT;
705 705
 	query_vals[n_query_cols].nul = 0;
706
-	query_vals[n_query_cols].val.int_val= UPDATED_TYPE; 
706
+	query_vals[n_query_cols].val.int_val=
707
+		core_hash(res_id, NULL,
708
+				(waitn_time * rls_notifier_poll_rate) - 1);
707 709
 	n_query_cols++;
708 710
 		
709 711
 	query_cols[n_query_cols]= &str_auth_state_col;
... ...
@@ -821,6 +823,7 @@ error:
821 823
 
822 824
 void timer_send_notify(unsigned int ticks,void *param)
823 825
 {
826
+	static int round = 0;
824 827
 	db_key_t query_cols[1], update_cols[1], result_cols[6];
825 828
 	db_val_t query_vals[1], update_vals[1];
826 829
 	int did_col, resource_uri_col, auth_state_col, reason_col,
... ...
@@ -831,7 +834,8 @@ void timer_send_notify(unsigned int ticks,void *param)
831 834
 	query_cols[0]= &str_updated_col;
832 835
 	query_vals[0].type = DB1_INT;
833 836
 	query_vals[0].nul = 0;
834
-	query_vals[0].val.int_val= UPDATED_TYPE; 
837
+	query_vals[0].val.int_val= round;
838
+	if (++round > (waitn_time * rls_notifier_poll_rate) - 1) round = 0;
835 839
 
836 840
 	result_cols[did_col= n_result_cols++]= &str_rlsubs_did_col;
837 841
 	result_cols[resource_uri_col= n_result_cols++]= &str_resource_uri_col;
... ...
@@ -41,6 +41,7 @@
41 41
 #include "../../dprint.h"
42 42
 #include "../../error.h"
43 43
 #include "../../ut.h"
44
+#include "../../timer_proc.h"
44 45
 #include "../../hashes.h"
45 46
 #include "../../mem/mem.h"
46 47
 #include "../../mem/shm_mem.h"
... ...
@@ -73,7 +74,8 @@ db_func_t rls_xcap_dbf;
73 74
 /** modules variables */
74 75
 str rls_server_address = {0, 0};
75 76
 int rls_expires_offset=0;
76
-int waitn_time = 10;
77
+int waitn_time = 5;
78
+int rls_notifier_poll_rate = 10;
77 79
 str rlsubs_table = str_init("rls_watchers");
78 80
 str rlpres_table = str_init("rls_presentity");
79 81
 str rls_xcap_table = str_init("xcap");
... ...
@@ -222,6 +224,7 @@ static param_export_t params[]={
222 224
 	{ "rlpres_table",           STR_PARAM,   &rlpres_table.s                 },
223 225
 	{ "xcap_table",             STR_PARAM,   &rls_xcap_table.s               },
224 226
 	{ "waitn_time",             INT_PARAM,   &waitn_time                     },
227
+	{ "notifier_poll_rate",     INT_PARAM,   &rls_notifier_poll_rate         },
225 228
 	{ "clean_period",           INT_PARAM,   &clean_period                   },
226 229
 	{ "rlpres_clean_period",    INT_PARAM,   &rlpres_clean_period            },
227 230
 	{ "max_expires",            INT_PARAM,   &rls_max_expires                },
... ...
@@ -297,34 +300,34 @@ static int mod_init(void)
297 300
 		rls_outbound_proxy.len = strlen(rls_outbound_proxy.s);
298 301
 	/* extract port if any */
299 302
 	if(xcap_root)
300
-    {
301
-        sep= strchr(xcap_root, ':');
302
-        if(sep)
303
-        {
304
-            char* sep2= NULL;
305
-            sep2= strchr(sep+ 1, ':');
306
-            if(sep2)
307
-                sep= sep2;
308
-
309
-            str port_str;
310
-
311
-            port_str.s= sep+ 1;
312
-            port_str.len= strlen(xcap_root)- (port_str.s-xcap_root);
313
-
314
-            if(str2int(&port_str, &xcap_port)< 0)
315
-            {
316
-                LM_ERR("converting string to int [port]= %.*s\n",port_str.len,
317
-                        port_str.s);
318
-                return -1;
319
-            }
320
-            if(xcap_port< 0 || xcap_port> 65535)
321
-            {
322
-                LM_ERR("wrong xcap server port\n");
323
-                return -1;
324
-            }
325
-            *sep= '\0';
326
-        }
327
-    }
303
+	{
304
+		sep= strchr(xcap_root, ':');
305
+		if(sep)
306
+		{
307
+			char* sep2= NULL;
308
+			sep2= strchr(sep+ 1, ':');
309
+			if(sep2)
310
+				sep= sep2;
311
+
312
+			str port_str;
313
+
314
+			port_str.s= sep+ 1;
315
+			port_str.len= strlen(xcap_root)- (port_str.s-xcap_root);
316
+
317
+			if(str2int(&port_str, &xcap_port)< 0)
318
+			{
319
+				LM_ERR("converting string to int [port]= %.*s\n",
320
+					port_str.len, port_str.s);
321
+				return -1;
322
+			}
323
+			if(xcap_port< 0 || xcap_port> 65535)
324
+			{
325
+				LM_ERR("wrong xcap server port\n");
326
+				return -1;
327
+			}
328
+			*sep= '\0';
329
+		}
330
+	}
328 331
 
329 332
 	/* bind the SL API */
330 333
 	if (sl_load_api(&slb)!=0) {
... ...
@@ -535,6 +538,9 @@ static int mod_init(void)
535 538
 	if(waitn_time<= 0)
536 539
 		waitn_time= 5;
537 540
 
541
+	if(rls_notifier_poll_rate<= 0)
542
+		rls_notifier_poll_rate= 10;
543
+
538 544
 	/* bind libxml wrapper functions */
539 545
 
540 546
 	if((bind_libxml=(bind_libxml_t)find_export("bind_libxml_api", 1, 0))== NULL)
... ...
@@ -615,7 +621,8 @@ static int mod_init(void)
615 621
 			return -1;
616 622
 		}
617 623
 	}
618
-	register_timer(timer_send_notify,0, waitn_time);
624
+
625
+	register_basic_timers(1);
619 626
 
620 627
 	if (rlpres_clean_period < 0)
621 628
 		rlpres_clean_period = clean_period;
... ...
@@ -628,7 +635,7 @@ static int mod_init(void)
628 635
 
629 636
 	if ((rls_update_subs_lock = lock_alloc()) == NULL)
630 637
 	{
631
-		LM_ERR("Failed to alloc rls_updae_subs_lock\n");
638
+		LM_ERR("Failed to alloc rls_update_subs_lock\n");
632 639
 		return -1;
633 640
 	}
634 641
 	if (lock_init(rls_update_subs_lock) == NULL)
... ...
@@ -648,6 +655,17 @@ static int child_init(int rank)
648 655
 	if (rank==PROC_INIT || rank==PROC_TCP_MAIN)
649 656
 		return 0; /* don't call child_init for main process more than once */
650 657
 
658
+	if (rank==PROC_MAIN)
659
+	{
660
+		if (fork_basic_utimer(PROC_TIMER, "RLS NOTIFIER", 1,
661
+					timer_send_notify, NULL,
662
+					1000000/rls_notifier_poll_rate) < 0)
663
+		{
664
+			LM_ERR("Failed to start RLS NOTIFIER\n");
665
+			return -1;
666
+		}
667
+	}
668
+
651 669
 	LM_DBG("child [%d]  pid [%d]\n", rank, getpid());
652 670
 
653 671
 	if (rls_dbf.init==0)
... ...
@@ -88,6 +88,7 @@ extern char* xcap_root;
88 88
 extern unsigned int xcap_port;
89 89
 extern str rls_server_address;
90 90
 extern int waitn_time;
91
+extern int rls_notifier_poll_rate;
91 92
 extern str rlsubs_table;
92 93
 extern str rlpres_table;
93 94
 extern str rls_xcap_table;