diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2014-12-16 18:04:53 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2014-12-16 18:04:55 +0100 |
commit | 201a8c2e36e250f49d5c729b11563730dfa4c484 (patch) | |
tree | 75ef4180c1c4b344b96820367c06961d35d571f0 | |
parent | 9969d042bbedfddfb9589bdcc05d877a3bd1fa84 (diff) |
channel: throw auth error when coroutine ends
It is common that clients attempt to reconnect during the
SPICE_CHANNEL_ERROR_AUTH callback. However, the channel must exit
the coroutine first before reconnection can happen.
-rw-r--r-- | gtk/spice-channel.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 4081e0b..c00bb42 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -1069,8 +1069,6 @@ static void spice_channel_failed_authentication(SpiceChannel *channel) c->state = SPICE_CHANNEL_STATE_FAILED_AUTHENTICATION; - g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, SPICE_CHANNEL_ERROR_AUTH); - c->has_error = TRUE; /* force disconnect */ } @@ -2182,6 +2180,9 @@ static gboolean spice_channel_delayed_unref(gpointer data) g_return_val_if_fail(c->coroutine.coroutine.exited == TRUE, FALSE); + if (c->state == SPICE_CHANNEL_STATE_FAILED_AUTHENTICATION) + g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, SPICE_CHANNEL_ERROR_AUTH); + g_object_unref(G_OBJECT(data)); return FALSE; @@ -2458,6 +2459,7 @@ static gboolean connect_delayed(gpointer data) return FALSE; } +/* any context */ static gboolean channel_connect(SpiceChannel *channel) { SpiceChannelPrivate *c = channel->priv; @@ -2639,7 +2641,6 @@ static void channel_disconnect(SpiceChannel *channel) if (c->state == SPICE_CHANNEL_STATE_READY) g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, SPICE_CHANNEL_CLOSED); - c->state = SPICE_CHANNEL_STATE_UNCONNECTED; spice_channel_reset(channel, FALSE); g_return_if_fail(SPICE_IS_CHANNEL(channel)); |