[Spice-devel] [PATCH spice-server 8/8] log: improve debug information related to client disconnection

Yonit Halperin yhalperi at redhat.com
Fri Jul 26 11:08:38 PDT 2013


---
 server/red_channel.c | 9 ++++++---
 server/snd_worker.c  | 7 ++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/server/red_channel.c b/server/red_channel.c
index 9b5e314..89b4092 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -1109,6 +1109,7 @@ static void red_channel_client_ref(RedChannelClient *rcc)
 static void red_channel_client_unref(RedChannelClient *rcc)
 {
     if (!--rcc->refs) {
+        spice_debug("destroy rcc=%p", rcc);
         if (rcc->send_data.main.marshaller) {
             spice_marshaller_destroy(rcc->send_data.main.marshaller);
         }
@@ -1705,6 +1706,8 @@ static void red_channel_client_disconnect_dummy(RedChannelClient *rcc)
 {
     spice_assert(rcc->dummy);
     if (ring_item_is_linked(&rcc->channel_link)) {
+        spice_printerr("rcc=%p (channel=%p type=%d id=%d)", rcc, rcc->channel,
+                       rcc->channel->type, rcc->channel->id);
         red_channel_remove_client(rcc);
     }
     rcc->dummy_connected = FALSE;
@@ -1712,8 +1715,6 @@ static void red_channel_client_disconnect_dummy(RedChannelClient *rcc)
 
 void red_channel_client_disconnect(RedChannelClient *rcc)
 {
-    spice_printerr("%p (channel %p type %d id %d)", rcc, rcc->channel,
-                                                rcc->channel->type, rcc->channel->id);
     if (rcc->dummy) {
         red_channel_client_disconnect_dummy(rcc);
         return;
@@ -1721,6 +1722,8 @@ void red_channel_client_disconnect(RedChannelClient *rcc)
     if (!red_channel_client_is_connected(rcc)) {
         return;
     }
+    spice_printerr("rcc=%p (channel=%p type=%d id=%d)", rcc, rcc->channel,
+                   rcc->channel->type, rcc->channel->id);
     red_channel_client_pipe_clear(rcc);
     if (rcc->stream->watch) {
         rcc->channel->core->watch_remove(rcc->stream->watch);
@@ -2004,7 +2007,7 @@ void red_client_destroy(RedClient *client)
     RingItem *link, *next;
     RedChannelClient *rcc;
 
-    spice_printerr("destroy client with #channels %d", client->channels_num);
+    spice_printerr("destroy client %p with #channels=%d", client, client->channels_num);
     if (!pthread_equal(pthread_self(), client->thread_id)) {
         spice_warning("client->thread_id (0x%lx) != pthread_self (0x%lx)."
                       "If one of the threads is != io-thread && != vcpu-thread,"
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 3827416..ebddfcd 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -201,8 +201,8 @@ static SndChannel *snd_channel_get(SndChannel *channel)
 static SndChannel *snd_channel_put(SndChannel *channel)
 {
     if (!--channel->refs) {
+        spice_printerr("SndChannel=%p freed", channel);
         free(channel);
-        spice_printerr("sound channel freed");
         return NULL;
     }
     return channel;
@@ -216,7 +216,8 @@ static void snd_disconnect_channel(SndChannel *channel)
         spice_debug("not connected");
         return;
     }
-    spice_debug("%p", channel);
+    spice_debug("SndChannel=%p rcc=%p type=%d",
+                 channel, channel->channel_client, channel->channel_client->channel->type);
     worker = channel->worker;
     channel->cleanup(channel);
     red_channel_client_disconnect(worker->connection->channel_client);
@@ -976,11 +977,11 @@ static void snd_disconnect_channel_client(RedChannelClient *rcc)
 {
     SndWorker *worker;
 
-    spice_debug(NULL);
     spice_assert(rcc->channel);
     spice_assert(rcc->channel->data);
     worker = (SndWorker *)rcc->channel->data;
 
+    spice_debug("channel-type=%d", rcc->channel->type);
     if (worker->connection) {
         spice_assert(worker->connection->channel_client == rcc);
         snd_disconnect_channel(worker->connection);
-- 
1.8.1.4



More information about the Spice-devel mailing list