Skip to content

Commit

Permalink
change check-dns into T/F
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyanlei25 committed Aug 16, 2018
1 parent c865988 commit d5c0c7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/chassis-options-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1450,8 +1450,11 @@ show_check_dns(gpointer param) {
struct external_param *opt_param = (struct external_param *)param;
chassis *srv = opt_param->chas;
gint opt_type = opt_param->opt_type;
if (CAN_SHOW_OPTS_PROPERTY(opt_type) || CAN_SAVE_OPTS_PROPERTY(opt_type)) {
return g_strdup_printf("%d", srv->check_dns);
if (CAN_SHOW_OPTS_PROPERTY(opt_type)) {
return g_strdup_printf("%s", srv->check_dns ? "true" : "false");
}
if (CAN_SAVE_OPTS_PROPERTY(opt_type)) {
return (srv->check_dns == 0) ? g_strdup("false") : NULL;
}
return NULL;
}
Expand Down
9 changes: 6 additions & 3 deletions src/mysql-proxy-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ struct chassis_frontend_t {
gchar *sql_log_mode;
guint sql_log_idletime;
gint sql_log_maxnum;
gint check_dns;

int check_dns;
};

/**
Expand Down Expand Up @@ -201,7 +202,9 @@ chassis_frontend_new(void)
frontend->sql_log_mode = NULL;
frontend->sql_log_idletime = 0;
frontend->sql_log_maxnum = -1;

frontend->check_dns = 0;

return frontend;
}

Expand Down Expand Up @@ -537,8 +540,8 @@ chassis_frontend_set_chassis_options(struct chassis_frontend_t *frontend, chassi
assign_sql_log_maxnum, show_sql_log_maxnum, ALL_OPTS_PROPERTY);
chassis_options_add(opts,
"check-dns",
0, 0, OPTION_ARG_INT, &(frontend->check_dns),
"check dns when hostname changed","<int>",
0, 0, OPTION_ARG_NONE, &(frontend->check_dns),
"check dns when hostname changed",NULL,
assign_check_dns, show_check_dns, ALL_OPTS_PROPERTY);

return 0;
Expand Down

0 comments on commit d5c0c7c

Please sign in to comment.