]> Git Repo - qemu.git/commitdiff
QMP: Emit asynchronous events on all QMP monitors
authorAdam Litke <[email protected]>
Fri, 15 Jan 2010 14:34:02 +0000 (08:34 -0600)
committerAnthony Liguori <[email protected]>
Tue, 19 Jan 2010 22:31:04 +0000 (16:31 -0600)
When using a control/QMP monitor in tandem with a regular monitor, asynchronous
messages can get lost depending on the order of the QEMU program arguments.
QEMU events issued by monitor_protocol_event() always go to cur_mon.  If the
user monitor was specified on the command line first (or it has ,default), the
message will be directed to the user monitor (not the QMP monitor).
Additionally, only one QMP session is currently able to receive async messages.

To avoid this confusion, scan through the list of monitors and emit the message
on each QMP monitor.

Signed-off-by: Adam Litke <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
monitor.c

index fea73834d0da9510e42e452cbbc371ced8facda1..938eb3b0412493ea8cf936b72f8a64a3d4127b5f 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -334,13 +334,10 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
 {
     QDict *qmp;
     const char *event_name;
-    Monitor *mon = cur_mon;
+    Monitor *mon;
 
     assert(event < QEVENT_MAX);
 
-    if (!monitor_ctrl_mode(mon))
-        return;
-
     switch (event) {
         case QEVENT_DEBUG:
             event_name = "DEBUG";
@@ -379,7 +376,12 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
         qdict_put_obj(qmp, "data", data);
     }
 
-    monitor_json_emitter(mon, QOBJECT(qmp));
+    QLIST_FOREACH(mon, &mon_list, entry) {
+        if (!monitor_ctrl_mode(mon))
+            return;
+
+        monitor_json_emitter(mon, QOBJECT(qmp));
+    }
     QDECREF(qmp);
 }
 
This page took 0.035413 seconds and 4 git commands to generate.