From e17db5e4f67779f2e5095018bfda6f3b477e38ba Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Wed, 11 Aug 2010 00:33:03 +0000 Subject: cli: Do not await connection for miscellaneous cmds Signed-off-by: Vijay Bellur Signed-off-by: Anand V. Avati BUG: 1262 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1262 --- cli/src/cli-cmd.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'cli/src/cli-cmd.c') diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c index b61fc819f..4353cb6e7 100644 --- a/cli/src/cli-cmd.c +++ b/cli/src/cli-cmd.c @@ -44,6 +44,15 @@ static pthread_mutex_t conn_mutex = PTHREAD_MUTEX_INITIALIZER; int cli_op_ret = 0; int connected = 0; +static gf_boolean_t +cli_cmd_needs_connection (struct cli_cmd_word *word) +{ + if (!strcasecmp ("quit", word->word)) + return _gf_false; + + return _gf_true; +} + int cli_cmd_process (struct cli_state *state, int argc, char **argv) { @@ -51,6 +60,7 @@ cli_cmd_process (struct cli_state *state, int argc, char **argv) struct cli_cmd_word *word = NULL; struct cli_cmd_word *next = NULL; int i = 0; + gf_boolean_t await_conn = _gf_false; word = &state->tree.root; @@ -79,12 +89,16 @@ cli_cmd_process (struct cli_state *state, int argc, char **argv) return -1; } - ret = cli_cmd_await_connected (); - if (ret) { - cli_out ("Connection failed. Please check if gluster daemon" - " is operational."); - gf_log ("", GF_LOG_NORMAL, "Exiting with: %d", ret); - exit (ret); + await_conn = cli_cmd_needs_connection (word); + + if (await_conn) { + ret = cli_cmd_await_connected (); + if (ret) { + cli_out ("Connection failed. Please check if gluster " + "daemon is operational."); + gf_log ("", GF_LOG_NORMAL, "Exiting with: %d", ret); + exit (ret); + } } -- cgit