Revision 1dcbd6f6 monitor.c
b/monitor.c | ||
---|---|---|
642 | 642 |
const char *item = qdict_get_try_str(qdict, "item"); |
643 | 643 |
|
644 | 644 |
if (!item) { |
645 |
assert(monitor_ctrl_mode(mon) == 0); |
|
646 | 645 |
goto help; |
647 | 646 |
} |
648 | 647 |
|
... | ... | |
652 | 651 |
} |
653 | 652 |
|
654 | 653 |
if (cmd->name == NULL) { |
655 |
if (monitor_ctrl_mode(mon)) { |
|
656 |
qerror_report(QERR_COMMAND_NOT_FOUND, item); |
|
657 |
return -1; |
|
658 |
} |
|
659 | 654 |
goto help; |
660 | 655 |
} |
661 | 656 |
|
662 |
if (monitor_ctrl_mode(mon) && monitor_cmd_user_only(cmd)) { |
|
663 |
qerror_report(QERR_COMMAND_NOT_FOUND, item); |
|
664 |
return -1; |
|
665 |
} |
|
666 |
|
|
667 | 657 |
if (monitor_handler_is_async(cmd)) { |
668 |
if (monitor_ctrl_mode(mon)) { |
|
669 |
qmp_async_info_handler(mon, cmd); |
|
670 |
} else { |
|
671 |
user_async_info_handler(mon, cmd); |
|
672 |
} |
|
658 |
user_async_info_handler(mon, cmd); |
|
673 | 659 |
/* |
674 | 660 |
* Indicate that this command is asynchronous and will not return any |
675 | 661 |
* data (not even empty). Instead, the data will be returned via a |
... | ... | |
677 | 663 |
*/ |
678 | 664 |
*ret_data = qobject_from_jsonf("{ '__mon_async': 'return' }"); |
679 | 665 |
} else if (monitor_handler_ported(cmd)) { |
680 |
cmd->mhandler.info_new(mon, ret_data);
|
|
666 |
QObject *info_data = NULL;
|
|
681 | 667 |
|
682 |
if (!monitor_ctrl_mode(mon)) { |
|
683 |
/* |
|
684 |
* User Protocol function is called here, Monitor Protocol is |
|
685 |
* handled by monitor_call_handler() |
|
686 |
*/ |
|
687 |
if (*ret_data) |
|
688 |
cmd->user_print(mon, *ret_data); |
|
668 |
cmd->mhandler.info_new(mon, &info_data); |
|
669 |
if (info_data) { |
|
670 |
cmd->user_print(mon, info_data); |
|
671 |
qobject_decref(info_data); |
|
689 | 672 |
} |
690 | 673 |
} else { |
691 |
if (monitor_ctrl_mode(mon)) { |
|
692 |
/* handler not converted yet */ |
|
693 |
qerror_report(QERR_COMMAND_NOT_FOUND, item); |
|
694 |
return -1; |
|
695 |
} else { |
|
696 |
cmd->mhandler.info(mon); |
|
697 |
} |
|
674 |
cmd->mhandler.info(mon); |
|
698 | 675 |
} |
699 | 676 |
|
700 | 677 |
return 0; |
Also available in: Unified diff