diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt index d36da468ad..1e87eb16c6 100644 --- a/QMP/qmp-events.txt +++ b/QMP/qmp-events.txt @@ -31,3 +31,9 @@ Data: None. Description: Issued when a VNC client establishes a connection. Data: 'server' and 'client' keys with the same keys as 'query-vnc', except that authentication ID is not provided. + +5 VNC_DISCONNECTED +------------------ + +Description: Issued when the conection is closed. +Data: 'server' and 'client' keys with the same keys as 'query-vnc'. diff --git a/monitor.c b/monitor.c index c92668045a..2540d9467d 100644 --- a/monitor.c +++ b/monitor.c @@ -360,6 +360,9 @@ void monitor_protocol_event(MonitorEvent event, QObject *data) case QEVENT_VNC_CONNECTED: event_name = "VNC_CONNECTED"; break; + case QEVENT_VNC_DISCONNECTED: + event_name = "VNC_DISCONNECTED"; + break; default: abort(); break; diff --git a/monitor.h b/monitor.h index 4d57679000..42386de222 100644 --- a/monitor.h +++ b/monitor.h @@ -21,6 +21,7 @@ typedef enum MonitorEvent { QEVENT_POWERDOWN, QEVENT_STOP, QEVENT_VNC_CONNECTED, + QEVENT_VNC_DISCONNECTED, QEVENT_MAX, } MonitorEvent; diff --git a/vnc.c b/vnc.c index 6d488e52ce..a590bb9c81 100644 --- a/vnc.c +++ b/vnc.c @@ -1108,6 +1108,8 @@ static void vnc_disconnect_start(VncState *vs) static void vnc_disconnect_finish(VncState *vs) { + vnc_qmp_event(vs, QEVENT_VNC_DISCONNECTED); + if (vs->input.buffer) { qemu_free(vs->input.buffer); vs->input.buffer = NULL;