summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-03-08 15:41:54 +0100
committerHans de Goede <hdegoede@redhat.com>2013-04-09 13:12:07 +0200
commit0b81c90deaa51c6233b911e35a6adff29c3643f9 (patch)
tree966de0387854fceaa6562ba70a3399017505e2a3
parente86fe5e8c8e7921062f881b78e439f21d4304b8d (diff)
channel-main: Cancel active file-xfers on channel/agent disconnect
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--gtk/channel-main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 7513ead..01c0659 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -165,6 +165,7 @@ static gboolean main_migrate_handshake_done(gpointer data);
static void spice_main_channel_send_migration_handshake(SpiceChannel *channel);
static void file_xfer_continue_read(SpiceFileXferTask *task);
static void file_xfer_completed(SpiceFileXferTask *task, GError *error);
+static void file_xfer_flushed(SpiceMainChannel *channel, gboolean success);
/* ------------------------------------------------------------------ */
@@ -332,6 +333,8 @@ static void spice_channel_iterate_write(SpiceChannel *channel)
static void spice_main_channel_reset_agent(SpiceMainChannel *channel)
{
SpiceMainChannelPrivate *c = channel->priv;
+ GError *error;
+ GList *l;
c->agent_connected = FALSE;
c->agent_caps_received = FALSE;
@@ -340,6 +343,15 @@ static void spice_main_channel_reset_agent(SpiceMainChannel *channel)
g_free(c->agent_msg_data);
c->agent_msg_data = NULL;
c->agent_msg_size = 0;
+
+ for (l = c->file_xfer_task_list; l != NULL; l = l->next) {
+ SpiceFileXferTask *task = (SpiceFileXferTask *)l->data;
+
+ error = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
+ "Agent connection closed");
+ file_xfer_completed(task, error);
+ }
+ file_xfer_flushed(channel, FALSE);
}
/* main or coroutine context */