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

Function weight_based_sort_cb

modules/drouting/drouting.c:2940–2959  ·  view source on GitHub ↗

sort based on the weight of the gws */

Source from the content-addressed store, hash-verified

2938
2939/* sort based on the weight of the gws */
2940static void weight_based_sort_cb(void *params)
2941{
2942 pgw_list_t *pgwl;
2943 int size;
2944 int rc;
2945 unsigned short *sorted_dst;
2946 struct dr_sort_params *dsp = (struct dr_sort_params *)params;
2947
2948 rc = get_pgwl_params(dsp, &pgwl, &size, &sorted_dst);
2949 if (rc < 0) {
2950 LM_WARN("failed to sort\n");
2951 dsp->rc = -1;
2952 return;
2953 }
2954
2955 if (weight_based_sort(pgwl, size, sorted_dst) < 0)
2956 dsp->rc = -1;
2957 else
2958 dsp->rc = 0;
2959}
2960
2961/* sort based on the weight of the gws */
2962static int weight_based_sort(pgw_list_t *pgwl, int size, unsigned short *idx)

Callers

nothing calls this directly

Calls 2

get_pgwl_paramsFunction · 0.85
weight_based_sortFunction · 0.85

Tested by

no test coverage detected