From 7e0c5e8da1526180086e2341780896613ef9d957 Mon Sep 17 00:00:00 2001 From: Yonit Halperin Date: Fri, 26 Jul 2013 12:15:00 -0400 Subject: [PATCH] log: improve debug information related to client disconnection --- 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 9433bef..1a57db5 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -1100,6 +1100,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); } @@ -1696,6 +1697,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; @@ -1703,8 +1706,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; @@ -1712,6 +1713,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); @@ -1995,7 +1998,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);