[Spice-commits] 4 commits - src/channel-port.c src/qmp-port.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Sep 27 12:10:04 UTC 2018
src/channel-port.c | 1 -
src/qmp-port.c | 23 +++++++++++++++++++----
2 files changed, 19 insertions(+), 5 deletions(-)
New commits:
commit ff0fdf1ec91e6caa71c15b290fae6aa7e3b1ed9f
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Wed Sep 26 17:34:44 2018 +0400
qmp: clear all pending tasks on close event
g_hash_table_remove() will call the free handler and dispose the
pending tasks.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/src/qmp-port.c b/src/qmp-port.c
index 89b27aa..c91f967 100644
--- a/src/qmp-port.c
+++ b/src/qmp-port.c
@@ -209,6 +209,15 @@ static void spice_qmp_port_dispose(GObject *gobject)
G_OBJECT_CLASS(spice_qmp_port_parent_class)->dispose(gobject);
}
+static void spice_qmp_handle_port_event(SpiceQmpPort *self, gint event)
+{
+ SPICE_DEBUG("QMP port event:%d", event);
+
+ if (event == SPICE_PORT_EVENT_CLOSED) {
+ g_hash_table_remove_all(self->priv->qmp_tasks);
+ }
+}
+
static void spice_qmp_port_constructed(GObject *gobject)
{
SpiceQmpPort *self = SPICE_QMP_PORT(gobject);
@@ -220,6 +229,10 @@ static void spice_qmp_port_constructed(GObject *gobject)
"port-data", G_CALLBACK(spice_qmp_handle_port_data),
self, G_CONNECT_SWAPPED);
+ spice_g_signal_connect_object(self->priv->channel,
+ "port-event", G_CALLBACK(spice_qmp_handle_port_event),
+ self, G_CONNECT_SWAPPED);
+
if (G_OBJECT_CLASS(spice_qmp_port_parent_class)->constructed)
G_OBJECT_CLASS(spice_qmp_port_parent_class)->constructed(gobject);
}
commit 9b69956d04539dc9f937938aef99cfade48daba5
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Wed Sep 26 17:32:00 2018 +0400
qmp: release channel on dispose
Do not leak the strong channel ref.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/src/qmp-port.c b/src/qmp-port.c
index bdc0c7e..89b27aa 100644
--- a/src/qmp-port.c
+++ b/src/qmp-port.c
@@ -203,6 +203,8 @@ static void spice_qmp_port_dispose(GObject *gobject)
g_object_set_data(G_OBJECT(self->priv->channel),
"spice-qmp-port", NULL);
+ g_clear_object(&self->priv->channel);
+
if (G_OBJECT_CLASS(spice_qmp_port_parent_class)->dispose)
G_OBJECT_CLASS(spice_qmp_port_parent_class)->dispose(gobject);
}
commit 7d38526b77fc6cba0781d2b879ffbf2769d8ae0c
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Wed Sep 26 18:53:45 2018 +0400
qmp: use SPICE_DEBUG for consistency
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/src/qmp-port.c b/src/qmp-port.c
index c32bdc4..bdc0c7e 100644
--- a/src/qmp-port.c
+++ b/src/qmp-port.c
@@ -101,7 +101,7 @@ spice_qmp_dispatch_message(SpiceQmpPort *self)
if (json_object_get_member(obj, "QMP")) {
g_warn_if_fail(!self->priv->ready);
- g_debug("QMP greeting received");
+ SPICE_DEBUG("QMP greeting received");
return TRUE;
}
@@ -109,7 +109,7 @@ spice_qmp_dispatch_message(SpiceQmpPort *self)
gint id = json_object_get_int_member(obj, "id");
const gchar *desc = json_object_get_string_member(obj, "desc");
- g_debug("QMP return error: %s, id:%d", desc, id);
+ SPICE_DEBUG("QMP return error: %s, id:%d", desc, id);
task = g_hash_table_lookup(self->priv->qmp_tasks, GINT_TO_POINTER(id));
g_return_val_if_fail(task != NULL, TRUE);
g_hash_table_steal(self->priv->qmp_tasks, GINT_TO_POINTER(id));
@@ -118,7 +118,7 @@ spice_qmp_dispatch_message(SpiceQmpPort *self)
gint id = json_object_get_int_member(obj, "id");
QMPCb *cb;
- g_debug("QMP return id:%d", id);
+ SPICE_DEBUG("QMP return id:%d", id);
if (!self->priv->ready && id == 0) {
self->priv->ready = TRUE;
g_object_notify(G_OBJECT(self), "ready");
@@ -131,7 +131,7 @@ spice_qmp_dispatch_message(SpiceQmpPort *self)
g_hash_table_steal(self->priv->qmp_tasks, GINT_TO_POINTER(id));
cb(task, node);
} else if ((event = json_object_get_string_member(obj, "event"))) {
- g_debug("QMP event %s", event);
+ SPICE_DEBUG("QMP event %s", event);
g_signal_emit(G_OBJECT(self), signals[SIGNAL_EVENT], 0, event,
json_object_get_member(obj, "data"));
} else {
commit b7ed7a07923ce5e20413793d221f3c9b0fb8b469
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Wed Sep 26 17:31:07 2018 +0400
channel-port: fix invalid arg comment
There is no size argument for SpicePortChannel::port-event signal.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/src/channel-port.c b/src/channel-port.c
index d9c5a6c..2b6fb75 100644
--- a/src/channel-port.c
+++ b/src/channel-port.c
@@ -172,7 +172,6 @@ static void spice_port_channel_class_init(SpicePortChannelClass *klass)
* SpicePortChannel::port-event:
* @channel: the channel that emitted the signal
* @event: the event received
- * @size: number of bytes read
*
* The #SpicePortChannel::port-event signal is emitted when new
* port event is received.
More information about the Spice-commits
mailing list