summary refs log tree commit diff stats
path: root/monitor/qmp.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2020-10-05 17:58:47 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-10-09 07:08:19 +0200
commit41725fa7eda1d97576fc8c79b58d04a61629f40e (patch)
treea0e2212ef757445c25a6bc4d385e0c999f832dc5 /monitor/qmp.c
parent57d3635e42752289388b0a178fd636acbf3b90fa (diff)
downloadfocaccia-qemu-41725fa7eda1d97576fc8c79b58d04a61629f40e.tar.gz
focaccia-qemu-41725fa7eda1d97576fc8c79b58d04a61629f40e.zip
qmp: Call monitor_set_cur() only in qmp_dispatch()
The correct way to set the current monitor for a coroutine handler will
be different than for a blocking handler, so monitor_set_cur() needs to
be called in qmp_dispatch().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20201005155855.256490-7-kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'monitor/qmp.c')
-rw-r--r--monitor/qmp.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/monitor/qmp.c b/monitor/qmp.c
index 8469970c69..e746b3575d 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -135,16 +135,11 @@ static void monitor_qmp_respond(MonitorQMP *mon, QDict *rsp)
 
 static void monitor_qmp_dispatch(MonitorQMP *mon, QObject *req)
 {
-    Monitor *old_mon;
     QDict *rsp;
     QDict *error;
 
-    old_mon = monitor_set_cur(&mon->common);
-    assert(old_mon == NULL);
-
-    rsp = qmp_dispatch(mon->commands, req, qmp_oob_enabled(mon));
-
-    monitor_set_cur(NULL);
+    rsp = qmp_dispatch(mon->commands, req, qmp_oob_enabled(mon),
+                       &mon->common);
 
     if (mon->commands == &qmp_cap_negotiation_commands) {
         error = qdict_get_qdict(rsp, "error");