log: improve debug information related to client disconnection

This commit is contained in:
Yonit Halperin 2013-07-26 12:15:00 -04:00
parent 02f44c137d
commit c2e46b926e
2 changed files with 10 additions and 6 deletions

View File

@ -1112,6 +1112,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);
}
@ -1708,6 +1709,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;
@ -1715,8 +1718,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;
@ -1724,6 +1725,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);
@ -2007,7 +2010,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,"

View File

@ -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);