[Spice-devel] [PATCH 3/3] server: inputs_channel: inputs_link: don't assert on existing channel

Alon Levy alevy at redhat.com
Wed May 4 08:51:55 PDT 2011


If we do connect/reconnect fast enough a new inputs connection can happen while
the old channel has not been shutdown yet. Instead of finding the route cause,
it seems better to handle this situation at the channel level: just shutdown
the channel on a new connection. Fixes a frequent assert I've encountered when
debugging, where a client is connected and disconnected every few seconds.
After a few times the assert removed by this patch is triggered.
---
 server/inputs_channel.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index 0cc53a2..4da99ca 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -514,9 +514,11 @@ static void inputs_link(Channel *channel, RedsStream *stream, int migration,
                         uint32_t *caps)
 {
     InputsChannel *inputs_channel;
-    red_printf("");
-    ASSERT(channel->data == NULL);
 
+    red_printf("");
+    if (channel->data) {
+        inputs_shutdown(channel);
+    }
     g_inputs_channel = inputs_channel = (InputsChannel*)red_channel_create_parser(
         sizeof(*inputs_channel), stream, core, migration, FALSE /* handle_acks */
         ,inputs_channel_config_socket
-- 
1.7.5



More information about the Spice-devel mailing list