diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-03-05 17:58:31 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-03-05 18:18:03 +0100 |
commit | 73a28efdbadade681a5a6ae4f639315083a9c8ab (patch) | |
tree | 0c663a012c37dabe77216da540a1371145164390 | |
parent | ec2e3a3c01837bb72bf3e143522aa87d532ba9af (diff) |
Warn if a message is dropped (before connection or after reset)
Since c2ba62666beaee526e1b4288f9bd66976ce780ef messages can be ignored
when a channel is reset. A warning can help explain why some messages
are dropped.
-rw-r--r-- | gtk/spice-channel.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index c1c145a..d0a287b 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -678,26 +678,31 @@ static gboolean spice_channel_idle_wakeup(gpointer user_data) G_GNUC_INTERNAL void spice_msg_out_send(SpiceMsgOut *out) { + gboolean was_empty; + g_return_if_fail(out != NULL); g_return_if_fail(out->channel != NULL); g_static_mutex_lock(&out->channel->priv->xmit_queue_lock); - if (!out->channel->priv->xmit_queue_blocked) { - gboolean was_empty; - - was_empty = g_queue_is_empty(&out->channel->priv->xmit_queue); - g_queue_push_tail(&out->channel->priv->xmit_queue, out); - - /* One wakeup is enough to empty the entire queue -> only do a wakeup - if the queue was empty, and there isn't one pending already. */ - if (was_empty && !out->channel->priv->xmit_queue_wakeup_id) { - out->channel->priv->xmit_queue_wakeup_id = - /* Use g_timeout_add_full so that can specify the priority */ - g_timeout_add_full(G_PRIORITY_HIGH, 0, - spice_channel_idle_wakeup, - out->channel, NULL); - } + if (out->channel->priv->xmit_queue_blocked) { + g_warning("message queue is blocked, dropping message"); + goto end; + } + + was_empty = g_queue_is_empty(&out->channel->priv->xmit_queue); + g_queue_push_tail(&out->channel->priv->xmit_queue, out); + + /* One wakeup is enough to empty the entire queue -> only do a wakeup + if the queue was empty, and there isn't one pending already. */ + if (was_empty && !out->channel->priv->xmit_queue_wakeup_id) { + out->channel->priv->xmit_queue_wakeup_id = + /* Use g_timeout_add_full so that can specify the priority */ + g_timeout_add_full(G_PRIORITY_HIGH, 0, + spice_channel_idle_wakeup, + out->channel, NULL); } + +end: g_static_mutex_unlock(&out->channel->priv->xmit_queue_lock); } |