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

4c08dd
From c2e46b926e0ee4226f0f93942e7fa2c5b409f73d Mon Sep 17 00:00:00 2001
4c08dd
From: Yonit Halperin <yhalperi@redhat.com>
4c08dd
Date: Fri, 26 Jul 2013 12:15:00 -0400
4c08dd
Subject: [PATCH 8/8] 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
4c08dd
index 9168b8a..d565634 100644
4c08dd
--- a/server/red_channel.c
4c08dd
+++ b/server/red_channel.c
4c08dd
@@ -1112,6 +1112,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
         }
4c08dd
@@ -1708,6 +1709,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;
4c08dd
@@ -1715,8 +1718,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;
4c08dd
@@ -1724,6 +1725,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);
4c08dd
@@ -2007,7 +2010,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);
4c08dd
-- 
4c08dd
1.8.3.1
4c08dd