mirror of https://github.com/yandex/odyssey.git
odissey: parse SHOW STATS console statement
This commit is contained in:
parent
8e1bd24e90
commit
b098d031d7
|
@ -157,11 +157,25 @@ static inline int
|
||||||
od_console_query_show(od_console_t *console, od_parser_t *parser,
|
od_console_query_show(od_console_t *console, od_parser_t *parser,
|
||||||
od_msgconsole_t *msg_console)
|
od_msgconsole_t *msg_console)
|
||||||
{
|
{
|
||||||
(void)parser;
|
od_token_t token;
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
rc = od_console_show_stats(console, msg_console);
|
rc = od_parser_next(parser, &token);
|
||||||
return rc;
|
switch (rc) {
|
||||||
|
case OD_PARSER_KEYWORD:
|
||||||
|
break;
|
||||||
|
case OD_PARSER_EOF:
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
od_keyword_t *keyword;
|
||||||
|
keyword = od_keyword_match(od_console_keywords, &token);
|
||||||
|
if (keyword == NULL)
|
||||||
|
return -1;
|
||||||
|
switch (keyword->id) {
|
||||||
|
case OD_LSTATS:
|
||||||
|
return od_console_show_stats(console, msg_console);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
@ -197,12 +211,15 @@ od_console_query(od_console_t *console, od_msgconsole_t *msg_console)
|
||||||
goto bad_command;
|
goto bad_command;
|
||||||
switch (keyword->id) {
|
switch (keyword->id) {
|
||||||
case OD_LSHOW:
|
case OD_LSHOW:
|
||||||
return od_console_query_show(console, &parser, msg_console);
|
rc = od_console_query_show(console, &parser, msg_console);
|
||||||
|
if (rc == -1)
|
||||||
|
goto bad_command;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
goto bad_command;
|
goto bad_command;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return 0;
|
||||||
|
|
||||||
bad_command:
|
bad_command:
|
||||||
od_error_client(&instance->logger, &client->id, "console",
|
od_error_client(&instance->logger, &client->id, "console",
|
||||||
|
|
Loading…
Reference in New Issue