diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-03-06 10:47:08 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-06-02 09:59:14 +0200 |
commit | 70ea0c58991ae44b5a1e67d9c189d79029168cb1 (patch) | |
tree | 6b6845e587e7dc6aefde3dda3b3d5606feeb3805 | |
parent | 4086182fcd9b106345b5cc535d78bcc6d13a7683 (diff) |
monitor: Wean monitor_protocol_emitter() off mon->error
Move mon->error handling to its caller handle_qmp_command().
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
-rw-r--r-- | monitor.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -407,13 +407,14 @@ static QDict *build_qmp_error_dict(const QError *err) return qobject_to_qdict(obj); } -static void monitor_protocol_emitter(Monitor *mon, QObject *data) +static void monitor_protocol_emitter(Monitor *mon, QObject *data, + QError *err) { QDict *qmp; trace_monitor_protocol_emitter(mon); - if (!monitor_has_error(mon)) { + if (!err) { /* success response */ qmp = qdict_new(); if (data) { @@ -425,9 +426,7 @@ static void monitor_protocol_emitter(Monitor *mon, QObject *data) } } else { /* error response */ - qmp = build_qmp_error_dict(mon->error); - QDECREF(mon->error); - mon->error = NULL; + qmp = build_qmp_error_dict(err); } if (mon->mc->id) { @@ -5039,8 +5038,10 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens) } err_out: - monitor_protocol_emitter(mon, data); + monitor_protocol_emitter(mon, data, mon->error); qobject_decref(data); + QDECREF(mon->error); + mon->error = NULL; QDECREF(input); QDECREF(args); } |