|
@@ -713,7 +713,7 @@ err:
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
|
-int add_dest2list(int id, str uri, int flags, int priority, str *attrs,
|
|
|
+ds_dest_t *add_dest2list(int id, str uri, int flags, int priority, str *attrs,
|
|
|
int list_idx, int *setn, int dload, ds_latency_stats_t *latency_stats)
|
|
|
{
|
|
|
ds_dest_t *dp = NULL;
|
|
@@ -722,8 +722,9 @@ int add_dest2list(int id, str uri, int flags, int priority, str *attrs,
|
|
|
ds_dest_t *dp1 = NULL;
|
|
|
|
|
|
dp = pack_dest(uri, flags, priority, attrs, dload);
|
|
|
- if(!dp)
|
|
|
- goto err;
|
|
|
+ if(!dp) {
|
|
|
+ goto error;
|
|
|
+ }
|
|
|
|
|
|
if(latency_stats != NULL) {
|
|
|
dp->latency_stats.stdev = latency_stats->stdev;
|
|
@@ -739,7 +740,7 @@ int add_dest2list(int id, str uri, int flags, int priority, str *attrs,
|
|
|
sp = ds_avl_insert(&ds_lists[list_idx], id, setn);
|
|
|
if(!sp) {
|
|
|
LM_ERR("no more memory.\n");
|
|
|
- goto err;
|
|
|
+ goto error;
|
|
|
}
|
|
|
sp->nr++;
|
|
|
|
|
@@ -766,8 +767,8 @@ int add_dest2list(int id, str uri, int flags, int priority, str *attrs,
|
|
|
|
|
|
LM_DBG("dest [%d/%d] <%.*s>\n", sp->id, sp->nr, dp->uri.len, dp->uri.s);
|
|
|
|
|
|
- return 0;
|
|
|
-err:
|
|
|
+ return dp;
|
|
|
+error:
|
|
|
if(dp != NULL) {
|
|
|
if(dp->uri.s != NULL)
|
|
|
shm_free(dp->uri.s);
|
|
@@ -776,7 +777,7 @@ err:
|
|
|
shm_free(dp);
|
|
|
}
|
|
|
|
|
|
- return -1;
|
|
|
+ return NULL;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1112,7 +1113,7 @@ int ds_load_list(char *lfile)
|
|
|
}
|
|
|
if(add_dest2list(id, uri, flags, priority, &attrs, *ds_next_idx, &setn,
|
|
|
0, latency_stats)
|
|
|
- != 0) {
|
|
|
+ == NULL) {
|
|
|
LM_WARN("unable to add destination %.*s to set %d -- skipping\n",
|
|
|
uri.len, uri.s, id);
|
|
|
if(ds_load_mode == 1) {
|
|
@@ -1372,7 +1373,7 @@ int ds_load_db(void)
|
|
|
}
|
|
|
if(add_dest2list(id, uri, flags, priority, &attrs, *ds_next_idx, &setn,
|
|
|
0, latency_stats)
|
|
|
- != 0) {
|
|
|
+ == NULL) {
|
|
|
dest_errs++;
|
|
|
LM_WARN("unable to add destination %.*s to set %d -- skipping\n",
|
|
|
uri.len, uri.s, id);
|
|
@@ -2870,7 +2871,7 @@ void ds_add_dest_cb(ds_set_t *node, int i, void *arg)
|
|
|
node->dlist[i].priority, &node->dlist[i].attrs.body,
|
|
|
*ds_next_idx, &setn, node->dlist[i].dload,
|
|
|
&node->dlist[i].latency_stats)
|
|
|
- != 0) {
|
|
|
+ == NULL) {
|
|
|
LM_WARN("failed to add destination in group %d - %.*s\n", node->id,
|
|
|
node->dlist[i].uri.len, node->dlist[i].uri.s);
|
|
|
}
|
|
@@ -2893,7 +2894,7 @@ int ds_add_dst(int group, str *address, int flags, int priority, str *attrs)
|
|
|
// add new destination
|
|
|
if(add_dest2list(group, *address, flags, priority, attrs, *ds_next_idx,
|
|
|
&setn, 0, NULL)
|
|
|
- != 0) {
|
|
|
+ == NULL) {
|
|
|
LM_WARN("unable to add destination %.*s to set %d", address->len,
|
|
|
address->s, group);
|
|
|
if(ds_load_mode == 1) {
|
|
@@ -2934,7 +2935,7 @@ void ds_filter_dest_cb(ds_set_t *node, int i, void *arg)
|
|
|
node->dlist[i].priority, &node->dlist[i].attrs.body,
|
|
|
*ds_next_idx, filter_arg->setn, node->dlist[i].dload,
|
|
|
&node->dlist[i].latency_stats)
|
|
|
- != 0) {
|
|
|
+ == NULL) {
|
|
|
LM_WARN("failed to add destination in group %d - %.*s\n", node->id,
|
|
|
node->dlist[i].uri.len, node->dlist[i].uri.s);
|
|
|
}
|