From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXMkp-0004hR-8R for qemu-devel@nongnu.org; Tue, 19 Jan 2010 17:40:55 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXMkk-0004fX-K0 for qemu-devel@nongnu.org; Tue, 19 Jan 2010 17:40:54 -0500 Received: from [199.232.76.173] (port=58899 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXMkk-0004fS-FI for qemu-devel@nongnu.org; Tue, 19 Jan 2010 17:40:50 -0500 Received: from qw-out-1920.google.com ([74.125.92.150]:2972) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NXMkk-0004xe-8o for qemu-devel@nongnu.org; Tue, 19 Jan 2010 17:40:50 -0500 Received: by qw-out-1920.google.com with SMTP id 4so45100qwk.4 for ; Tue, 19 Jan 2010 14:40:49 -0800 (PST) Message-ID: <4B5634EE.6000007@codemonkey.ws> Date: Tue, 19 Jan 2010 16:40:46 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] QMP: Emit asynchronous events on all QMP monitors References: <1263504010.2847.27.camel@aglitke> <20100115113845.588e2398@doriath> <1263566042.3536.11.camel@aglitke> In-Reply-To: <1263566042.3536.11.camel@aglitke> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Adam Litke Cc: qemu-devel@nongnu.org, Luiz Capitulino On 01/15/2010 08:34 AM, Adam Litke wrote: > 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 > Applied. Thanks. Regards, Anthony Liguori > diff --git a/monitor.c b/monitor.c > index 134ed15..06c8bf0 100644 > --- 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"; > @@ -373,7 +370,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); > } > > > >