mod_distributor: Fix segfault when no node are added, and add the support to…

mod_distributor: Fix segfault when no node are added, and add the support to have a single node with total weight of 1 only


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16842 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 a7056933
......@@ -157,7 +157,7 @@ static int load_config(int reloading)
continue;
}
if (tmp >= lp->target_weight) {
if (tmp >= lp->target_weight && (lp->target_weight == 1 && tmp != 1)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Weight %d value incorrect, must be less than %d\n", tmp, lp->target_weight);
continue;
}
......@@ -196,7 +196,7 @@ static int load_config(int reloading)
if (accum < lp->target_weight) {
struct dist_node *np1;
int remain = lp->target_weight - accum;
int ea = remain / lp->node_count ? lp->node_count : 1;
int ea = remain / (lp->node_count ? lp->node_count : 1);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Total weight does not add up to total weight %d\n", lp->target_weight);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论