MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / ds_check_timer

Function ds_check_timer

modules/dispatcher/dispatch.c:2695–2854  ·  view source on GitHub ↗

* Timer for checking inactive destinations * * This timer is regularly fired. */

Source from the content-addressed store, hash-verified

2693 * This timer is regularly fired.
2694 */
2695void ds_check_timer(unsigned int ticks, void* param)
2696{
2697 struct gw_prob_pack {
2698 /* IMPORTANT, this member must be the first, as we use its pointer
2699 * to free the whole structure here */
2700 ds_options_callback_param_t params;
2701
2702 const struct socket_info *sock;
2703 struct usr_avp *avps;
2704
2705 struct gw_prob_pack *next;
2706 };
2707 ds_partition_t *partition;
2708 struct gw_prob_pack *pack, *pack_last, *pack_head;
2709 dlg_t *dlg;
2710 ds_set_p list;
2711 int_str val;
2712 int j;
2713 int nodes_no, node_idx=-1;
2714 unsigned int h;
2715
2716 if ( !( ds_cluster_id<=0
2717 || (ds_cluster_prob_mode == DS_CLUSTER_PROB_MODE_ALL)
2718 || (ds_cluster_prob_mode == DS_CLUSTER_PROB_MODE_DISTRIBUTED &&
2719 (node_idx=ds_cluster_get_my_index(&nodes_no))>=0 )
2720 || (ds_cluster_prob_mode == DS_CLUSTER_PROB_MODE_SHTAG &&
2721 ds_cluster_shtag_is_active())
2722 ) )
2723 return;
2724
2725 for (partition = partitions; partition; partition = partition->next){
2726 /* Check for the list. */
2727 if ( (*partition->data)->sets==NULL )
2728 continue;
2729
2730 pack_last = pack_head = NULL;
2731
2732 /* access ds data under reader's lock */
2733 lock_start_read( partition->lock );
2734
2735 /* Iterate over the groups and the entries of each group: */
2736 for( list=(*partition->data)->sets ; list!= NULL ; list= list->next)
2737 {
2738 for(j=0; j<list->nr; j++)
2739 {
2740 /* If list is probed by this proxy and the Flag of
2741 * the entry has "Probing" set, send a probe: */
2742 if ( (!ds_probing_list || in_int_list(ds_probing_list, list->id)==0) &&
2743 ((list->dlist[j].flags&DS_INACTIVE_DST)==0) &&
2744 (ds_probing_mode==1 || (list->dlist[j].flags&(DS_PROBING_DST|DS_PROBING_PERM_DST))!=0
2745 ))
2746 {
2747 /* stage 2 of checking, clustering level */
2748 if (node_idx>=0) {
2749 h=core_hash( &list->dlist[j].uri, NULL, 0);
2750 if ( (h % nodes_no) != node_idx)
2751 continue;
2752 }

Callers

nothing calls this directly

Calls 8

ds_cluster_get_my_indexFunction · 0.85
in_int_listFunction · 0.85
core_hashFunction · 0.85
shm_mallocFunction · 0.85
new_avpFunction · 0.85
ds_set_stateFunction · 0.85
shm_freeFunction · 0.85

Tested by

no test coverage detected