Blame SOURCES/0008-log-improve-debug-information-related-to-client-disc.patch

20333d
From 7e0c5e8da1526180086e2341780896613ef9d957 Mon Sep 17 00:00:00 2001
4c08dd
From: Yonit Halperin <yhalperi@redhat.com>
4c08dd
Date: Fri, 26 Jul 2013 12:15:00 -0400
20333d
Subject: [PATCH] log: improve debug information related to client
4c08dd
 disconnection
4c08dd
4c08dd
---
4c08dd
 server/red_channel.c | 9 ++++++---
4c08dd
 server/snd_worker.c  | 7 ++++---
4c08dd
 2 files changed, 10 insertions(+), 6 deletions(-)
4c08dd
4c08dd
diff --git a/server/red_channel.c b/server/red_channel.c
20333d
index 9433bef..1a57db5 100644
4c08dd
--- a/server/red_channel.c
4c08dd
+++ b/server/red_channel.c
20333d
@@ -1100,6 +1100,7 @@ static void red_channel_client_ref(RedChannelClient *rcc)
4c08dd
 static void red_channel_client_unref(RedChannelClient *rcc)
4c08dd
 {
4c08dd
     if (!--rcc->refs) {
4c08dd
+        spice_debug("destroy rcc=%p", rcc);
4c08dd
         if (rcc->send_data.main.marshaller) {
4c08dd
             spice_marshaller_destroy(rcc->send_data.main.marshaller);
4c08dd
         }
20333d
@@ -1696,6 +1697,8 @@ static void red_channel_client_disconnect_dummy(RedChannelClient *rcc)
4c08dd
 {
4c08dd
     spice_assert(rcc->dummy);
4c08dd
     if (ring_item_is_linked(&rcc->channel_link)) {
4c08dd
+        spice_printerr("rcc=%p (channel=%p type=%d id=%d)", rcc, rcc->channel,
4c08dd
+                       rcc->channel->type, rcc->channel->id);
4c08dd
         red_channel_remove_client(rcc);
4c08dd
     }
4c08dd
     rcc->dummy_connected = FALSE;
20333d
@@ -1703,8 +1706,6 @@ static void red_channel_client_disconnect_dummy(RedChannelClient *rcc)
4c08dd
 
4c08dd
 void red_channel_client_disconnect(RedChannelClient *rcc)
4c08dd
 {
4c08dd
-    spice_printerr("%p (channel %p type %d id %d)", rcc, rcc->channel,
4c08dd
-                                                rcc->channel->type, rcc->channel->id);
4c08dd
     if (rcc->dummy) {
4c08dd
         red_channel_client_disconnect_dummy(rcc);
4c08dd
         return;
20333d
@@ -1712,6 +1713,8 @@ void red_channel_client_disconnect(RedChannelClient *rcc)
4c08dd
     if (!red_channel_client_is_connected(rcc)) {
4c08dd
         return;
4c08dd
     }
4c08dd
+    spice_printerr("rcc=%p (channel=%p type=%d id=%d)", rcc, rcc->channel,
4c08dd
+                   rcc->channel->type, rcc->channel->id);
4c08dd
     red_channel_client_pipe_clear(rcc);
4c08dd
     if (rcc->stream->watch) {
4c08dd
         rcc->channel->core->watch_remove(rcc->stream->watch);
20333d
@@ -1995,7 +1998,7 @@ void red_client_destroy(RedClient *client)
4c08dd
     RingItem *link, *next;
4c08dd
     RedChannelClient *rcc;
4c08dd
 
4c08dd
-    spice_printerr("destroy client with #channels %d", client->channels_num);
4c08dd
+    spice_printerr("destroy client %p with #channels=%d", client, client->channels_num);
4c08dd
     if (!pthread_equal(pthread_self(), client->thread_id)) {
4c08dd
         spice_warning("client->thread_id (0x%lx) != pthread_self (0x%lx)."
4c08dd
                       "If one of the threads is != io-thread && != vcpu-thread,"
4c08dd
diff --git a/server/snd_worker.c b/server/snd_worker.c
4c08dd
index 3827416..ebddfcd 100644
4c08dd
--- a/server/snd_worker.c
4c08dd
+++ b/server/snd_worker.c
4c08dd
@@ -201,8 +201,8 @@ static SndChannel *snd_channel_get(SndChannel *channel)
4c08dd
 static SndChannel *snd_channel_put(SndChannel *channel)
4c08dd
 {
4c08dd
     if (!--channel->refs) {
4c08dd
+        spice_printerr("SndChannel=%p freed", channel);
4c08dd
         free(channel);
4c08dd
-        spice_printerr("sound channel freed");
4c08dd
         return NULL;
4c08dd
     }
4c08dd
     return channel;
4c08dd
@@ -216,7 +216,8 @@ static void snd_disconnect_channel(SndChannel *channel)
4c08dd
         spice_debug("not connected");
4c08dd
         return;
4c08dd
     }
4c08dd
-    spice_debug("%p", channel);
4c08dd
+    spice_debug("SndChannel=%p rcc=%p type=%d",
4c08dd
+                 channel, channel->channel_client, channel->channel_client->channel->type);
4c08dd
     worker = channel->worker;
4c08dd
     channel->cleanup(channel);
4c08dd
     red_channel_client_disconnect(worker->connection->channel_client);
4c08dd
@@ -976,11 +977,11 @@ static void snd_disconnect_channel_client(RedChannelClient *rcc)
4c08dd
 {
4c08dd
     SndWorker *worker;
4c08dd
 
4c08dd
-    spice_debug(NULL);
4c08dd
     spice_assert(rcc->channel);
4c08dd
     spice_assert(rcc->channel->data);
4c08dd
     worker = (SndWorker *)rcc->channel->data;
4c08dd
 
4c08dd
+    spice_debug("channel-type=%d", rcc->channel->type);
4c08dd
     if (worker->connection) {
4c08dd
         spice_assert(worker->connection->channel_client == rcc);
4c08dd
         snd_disconnect_channel(worker->connection);