Skip to content

Commit

Permalink
load_balancer: Refactor modparams
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuchircu committed Feb 10, 2017
1 parent a18ee7c commit cd55c05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions modules/load_balancer/lb_data.c
Expand Up @@ -40,8 +40,8 @@
/* dialog stuff */
extern struct dlg_binds lb_dlg_binds;

extern int fetch_freeswitch_load;
extern int startup_fs_load;
extern int fetch_freeswitch_stats;
extern int initial_fs_load;
extern struct fs_binds fs_api;


Expand Down Expand Up @@ -296,9 +296,9 @@ int add_lb_dsturi( struct lb_data *data, int id, int group, char *uri,
}
/* set the pointer and the max load */
dst->rmap[i].resource = res;
if (fetch_freeswitch_load && r->fs_url.s) {
if (fetch_freeswitch_stats && r->fs_url.s) {
fs_url = r->fs_url;
dst->rmap[i].max_load = startup_fs_load;
dst->rmap[i].max_load = initial_fs_load;
dst->rmap[i].fs_enabled = 1;
} else {
dst->rmap[i].max_load = r->val;
Expand Down Expand Up @@ -333,7 +333,7 @@ int add_lb_dsturi( struct lb_data *data, int id, int group, char *uri,
free_proxy(proxy);
pkg_free(proxy);

if (fetch_freeswitch_load && fs_url.s && fs_url.len > 0) {
if (fetch_freeswitch_stats && fs_url.s && fs_url.len > 0) {
dst->fs_sock = fs_api.add_hb_evs(&fs_url, &lb_str, NULL, NULL);
if (!dst->fs_sock) {
LM_ERR("failed to create FreeSWITCH stats socket!\n");
Expand Down
14 changes: 7 additions & 7 deletions modules/load_balancer/load_balancer.c
Expand Up @@ -69,8 +69,8 @@ str lb_probe_from = str_init("sip:prober@localhost");
static int* probing_reply_codes = NULL;
static int probing_codes_no = 0;

int fetch_freeswitch_load;
int startup_fs_load = 100;
int fetch_freeswitch_stats;
int initial_fs_load = 1000;

static int mod_init(void);
static int child_init(int rank);
Expand Down Expand Up @@ -164,8 +164,8 @@ static param_export_t mod_params[]={
{ "probing_from", STR_PARAM, &lb_probe_from.s },
{ "probing_reply_codes", STR_PARAM, &lb_probe_replies.s },
{ "lb_define_blacklist", STR_PARAM|USE_FUNC_PARAM, (void*)set_lb_bl},
{ "fetch_freeswitch_load", INT_PARAM, &fetch_freeswitch_load},
{ "startup_freeswitch_load", INT_PARAM, &startup_fs_load},
{ "fetch_freeswitch_stats", INT_PARAM, &fetch_freeswitch_stats},
{ "initial_freeswitch_load", INT_PARAM, &initial_fs_load},
{ 0,0,0 }
};

Expand Down Expand Up @@ -202,7 +202,7 @@ static dep_export_t deps = {
},
{ /* modparam dependencies */
{ "probing_interval", get_deps_probing_interval },
{ "fetch_freeswitch_load", get_deps_fetch_fs_load },
{ "fetch_freeswitch_stats", get_deps_fetch_fs_load },
{ NULL, NULL },
},
};
Expand Down Expand Up @@ -410,7 +410,7 @@ static int mod_init(void)
return -1;
}

if (fetch_freeswitch_load) {
if (fetch_freeswitch_stats) {
if (load_fs_api(&fs_api) == -1) {
LM_ERR("failed to load the FS API!\n");
return -1;
Expand Down Expand Up @@ -473,7 +473,7 @@ static int mod_init(void)
}

/* Register the max load recalculation timer */
if (fetch_freeswitch_load &&
if (fetch_freeswitch_stats &&
register_timer("lb-update-max-load", lb_update_max_loads, NULL,
FS_HEARTBEAT_ITV, TIMER_FLAG_SKIP_ON_DELAY)<0) {
LM_ERR("failed to register timer for max load recalc!\n");
Expand Down

0 comments on commit cd55c05

Please sign in to comment.