[Spice-commits] 4 commits - gtk/channel-main.c spice-common
Hans de Goede
jwrdegoede at kemper.freedesktop.org
Mon Mar 4 10:44:56 PST 2013
gtk/channel-main.c | 34 +++++++++++++++++++++++++++++-----
spice-common | 2 +-
2 files changed, 30 insertions(+), 6 deletions(-)
New commits:
commit b98697735091935cef2453e455495e6e48ff7921
Author: Hans de Goede <hdegoede at redhat.com>
Date: Sun Mar 3 17:50:13 2013 +0100
channel-main: Handle the new VD_AGENT_FILE_XFER_STATUS_SUCCESS status msg
So that we can pass along an error from the agent to report an xfer error
after the last FILE_XFER_DATA message has been sent.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index fa3fd91..2039a8a 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1630,24 +1630,22 @@ static void file_xfer_read_cb(GObject *source_object,
file_xfer_queue(task, count);
file_xfer_flush_async(channel, task->cancellable,
file_xfer_data_flushed_cb, task);
- } else {
- /* Error or EOF, close the file */
- if (error) {
- VDAgentFileXferStatusMessage msg = {
- .id = task->id,
- .result = VD_AGENT_FILE_XFER_STATUS_ERROR,
- };
- agent_msg_queue_many(task->channel, VD_AGENT_FILE_XFER_STATUS,
- &msg, sizeof(msg), NULL);
- spice_channel_wakeup(SPICE_CHANNEL(task->channel), FALSE);
- task->error = error;
- }
+ } else if (error) {
+ VDAgentFileXferStatusMessage msg = {
+ .id = task->id,
+ .result = VD_AGENT_FILE_XFER_STATUS_ERROR,
+ };
+ agent_msg_queue_many(task->channel, VD_AGENT_FILE_XFER_STATUS,
+ &msg, sizeof(msg), NULL);
+ spice_channel_wakeup(SPICE_CHANNEL(task->channel), FALSE);
+ task->error = error;
g_input_stream_close_async(G_INPUT_STREAM(task->file_stream),
G_PRIORITY_DEFAULT,
task->cancellable,
file_xfer_close_cb,
task);
}
+ /* else EOF, do nothing (wait for VD_AGENT_FILE_XFER_STATUS from agent) */
}
/* coroutine context */
@@ -1692,6 +1690,8 @@ static void file_xfer_handle_status(SpiceMainChannel *channel,
task->error = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
"some errors occurred in the spice agent");
break;
+ case VD_AGENT_FILE_XFER_STATUS_SUCCESS:
+ break;
default:
g_warn_if_reached();
task->error = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
commit 32ef2acbdcc5352710ced47d06abfc9ce95477bb
Author: Hans de Goede <hdegoede at redhat.com>
Date: Mon Mar 4 19:44:35 2013 +0100
Update spice-common
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
diff --git a/spice-common b/spice-common
index df09927..1a83284 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit df09927c3bb921f51a3a1f6ca09063bf44f1ee5b
+Subproject commit 1a83284e9c10e6572d78326473819d121c33feb8
commit 690d8e97311b5e0a3699874f118a0c4b9a098624
Author: Hans de Goede <hdegoede at redhat.com>
Date: Fri Mar 1 11:32:59 2013 +0100
channel-main: Send an error to the agent on file-xfer read error
So that the agent knows the rest of the file won't be coming.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index d2c6550..fa3fd91 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1633,6 +1633,13 @@ static void file_xfer_read_cb(GObject *source_object,
} else {
/* Error or EOF, close the file */
if (error) {
+ VDAgentFileXferStatusMessage msg = {
+ .id = task->id,
+ .result = VD_AGENT_FILE_XFER_STATUS_ERROR,
+ };
+ agent_msg_queue_many(task->channel, VD_AGENT_FILE_XFER_STATUS,
+ &msg, sizeof(msg), NULL);
+ spice_channel_wakeup(SPICE_CHANNEL(task->channel), FALSE);
task->error = error;
}
g_input_stream_close_async(G_INPUT_STREAM(task->file_stream),
commit 19313a133af0d2404b29914b5937219127ad455b
Author: Hans de Goede <hdegoede at redhat.com>
Date: Thu Feb 28 17:06:28 2013 +0100
channel-main: Fix dangling references to freed file-xfer-tasks on agent cancel
While testing the agent error handling code I was triggering the
agent-file-xfer-cancel code-path in spice-gtk. This crashes due to the
flushing queue still having a reference to the task in question when its
gets cancelled from the agent side. This fixes this.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index f86e81d..d2c6550 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1517,17 +1517,31 @@ static void file_xfer_task_free(SpiceFileXferTask *task)
}
/* main context */
+static void file_xfer_remove_flush(gpointer data, gpointer user_data)
+{
+ GAsyncResult *res = G_ASYNC_RESULT(data);
+ SpiceFileXferTask *task = user_data;
+ SpiceMainChannelPrivate *c = task->channel->priv;
+
+ if (g_async_result_get_user_data(res) == task) {
+ c->flushing = g_slist_remove(c->flushing, res);
+ g_object_unref(res);
+ }
+}
+
static void file_xfer_close_cb(GObject *object,
GAsyncResult *close_res,
gpointer user_data)
{
GSimpleAsyncResult *res;
SpiceFileXferTask *task;
+ SpiceMainChannelPrivate *c;
GInputStream *stream = G_INPUT_STREAM(object);
GError *error = NULL;
stream = G_INPUT_STREAM(object);
task = user_data;
+ c = task->channel->priv;
g_input_stream_close_finish(stream, close_res, &error);
if (error) {
@@ -1551,6 +1565,9 @@ static void file_xfer_close_cb(GObject *object,
g_simple_async_result_complete_in_idle(res);
g_object_unref(res);
+ /* On agent cancel there may be pending flushes referencing this task */
+ g_slist_foreach(c->flushing, file_xfer_remove_flush, task);
+
file_xfer_task_free(task);
}
diff --git a/spice-common b/spice-common
index 149bb89..df09927 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit 149bb89adb0d7676c41085b3e41f07113e05c880
+Subproject commit df09927c3bb921f51a3a1f6ca09063bf44f1ee5b
More information about the Spice-commits
mailing list