@@ -475,9 +475,8 @@ int notify_ebr_subscriptions( ebr_event *ev, evi_params_t *params)
475
475
476
476
/* check the EBR subscription on this event and apply the filters */
477
477
sub_prev = NULL ;
478
- sub_next = NULL ;
479
- for ( sub = ev -> subs ; sub ; sub_prev = sub ,
480
- sub = sub_next ?sub_next :(sub ?sub -> next :NULL ) ) {
478
+ for ( sub = ev -> subs ; sub ; sub_prev = sub , sub = sub_next ) {
479
+ sub_next = sub -> next ;
481
480
482
481
/* discard expired subscriptions */
483
482
if (sub -> expire < my_time ) {
@@ -492,7 +491,6 @@ int notify_ebr_subscriptions( ebr_event *ev, evi_params_t *params)
492
491
job = (ebr_ipc_job * )shm_malloc ( sizeof (ebr_ipc_job ) );
493
492
if (job == NULL ) {
494
493
LM_ERR ("failed to allocated new IPC job, skipping..\n" );
495
- sub_next = sub -> next ;
496
494
continue ; /* with the next subscription */
497
495
}
498
496
job -> ev = ev ;
@@ -505,12 +503,10 @@ int notify_ebr_subscriptions( ebr_event *ev, evi_params_t *params)
505
503
if (ipc_send_job ( sub -> proc_no , ebr_ipc_type , (void * )job )< 0 ) {
506
504
LM_ERR ("failed to send job via IPC, skipping...\n" );
507
505
shm_free (job );
508
- sub_next = sub -> next ;
509
506
continue ; /* keep it and try next time */
510
507
}
511
508
}
512
- /* remove the subscription */
513
- sub_next = sub -> next ;
509
+
514
510
/* unlink it */
515
511
if (sub_prev ) sub_prev -> next = sub_next ;
516
512
else ev -> subs = sub_next ;
@@ -523,7 +519,6 @@ int notify_ebr_subscriptions( ebr_event *ev, evi_params_t *params)
523
519
524
520
/* run the filters */
525
521
matches = 1 ;
526
- sub_next = NULL ;
527
522
for ( filter = sub -> filters ; matches && filter ; filter = filter -> next ) {
528
523
529
524
/* look for the evi param with the same name */
@@ -558,7 +553,6 @@ int notify_ebr_subscriptions( ebr_event *ev, evi_params_t *params)
558
553
job = (ebr_ipc_job * )shm_malloc ( sizeof (ebr_ipc_job ) );
559
554
if (job == NULL ) {
560
555
LM_ERR ("failed to allocated new IPC job, skipping..\n" );
561
- sub_next = sub -> next ;
562
556
continue ; /* with the next subscription */
563
557
}
564
558
@@ -595,9 +589,7 @@ int notify_ebr_subscriptions( ebr_event *ev, evi_params_t *params)
595
589
LM_ERR ("failed to send job via IPC, skipping...\n" );
596
590
shm_free (job );
597
591
}
598
- /* remove the subscription, as it can be triggered only
599
- * one time */
600
- sub_next = sub -> next ;
592
+
601
593
/* unlink it */
602
594
if (sub_prev ) sub_prev -> next = sub_next ;
603
595
else ev -> subs = sub_next ;
@@ -651,15 +643,12 @@ void ebr_timeout(unsigned int ticks, void* param)
651
643
652
644
/* check the EBR subscriptions on this event */
653
645
sub_prev = NULL ;
654
- sub_next = NULL ;
655
- for ( sub = ev -> subs ; sub ; sub_prev = sub ,
656
- sub = sub_next ?sub_next :(sub ?sub -> next :NULL ) ) {
646
+ for ( sub = ev -> subs ; sub ; sub_prev = sub , sub = sub_next ) {
647
+ sub_next = sub -> next ;
657
648
658
649
/* skip valid and non WAIT subscriptions */
659
- if ( (sub -> flags & EBR_SUBS_TYPE_WAIT )== 0 || sub -> expire > my_time ) {
660
- sub_next = sub -> next ;
650
+ if ( (sub -> flags & EBR_SUBS_TYPE_WAIT )== 0 || sub -> expire > my_time )
661
651
continue ;
662
- }
663
652
664
653
LM_DBG ("subscription type [%s] from process %d(pid %d) on "
665
654
"event <%.*s> expired at %d, now %d\n" ,
@@ -672,7 +661,6 @@ void ebr_timeout(unsigned int ticks, void* param)
672
661
job = (ebr_ipc_job * )shm_malloc ( sizeof (ebr_ipc_job ) );
673
662
if (job == NULL ) {
674
663
LM_ERR ("failed to allocated new IPC job, skipping..\n" );
675
- sub_next = sub -> next ;
676
664
continue ; /* with the next subscription */
677
665
}
678
666
job -> ev = ev ;
@@ -685,12 +673,9 @@ void ebr_timeout(unsigned int ticks, void* param)
685
673
if (ipc_send_job ( sub -> proc_no , ebr_ipc_type , (void * )job )< 0 ) {
686
674
LM_ERR ("failed to send job via IPC, skipping...\n" );
687
675
shm_free (job );
688
- sub_next = sub -> next ;
689
676
continue ; /* with the next subscription */
690
677
}
691
678
692
- /* remove the subscription */
693
- sub_next = sub -> next ;
694
679
/* unlink it */
695
680
if (sub_prev ) sub_prev -> next = sub_next ;
696
681
else ev -> subs = sub_next ;
0 commit comments