/*
This file is part of GNUnet.
- Copyright (C) 2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2013 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
static void
client_destroy (struct CadetClient *c)
{
- LOG (GNUNET_ERROR_TYPE_INFO, " client destroy: %p/%u\n", c, c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " client destroy: %p/%u\n", c, c->id);
GNUNET_SERVER_client_drop (c->handle);
c->shutting_down = GNUNET_YES;
GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, c);
GNUNET_STATISTICS_update (stats, "# clients", -1, GNUNET_NO);
+ GNUNET_SERVER_client_set_user_context (c->handle, NULL);
GNUNET_free (c);
}
GNUNET_CONTAINER_DLL_insert (clients_head, clients_tail, c);
GNUNET_STATISTICS_update (stats, "# clients", +1, GNUNET_NO);
- LOG (GNUNET_ERROR_TYPE_INFO, " client created: %p/%u\n", c, c->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " client created: %p/%u\n", c, c->id);
return c;
}
static void
handle_client_connect (void *cls, struct GNUNET_SERVER_Client *client)
{
- LOG (GNUNET_ERROR_TYPE_INFO, "Client connected: %p\n", client);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Client connected: %p\n", client);
if (NULL == client)
return;
{
struct CadetClient *c;
- LOG (GNUNET_ERROR_TYPE_INFO, "Client disconnected: %p\n", client);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Client disconnected: %p\n", client);
c = GML_client_get (client);
if (NULL != c)
}
else
{
- LOG (GNUNET_ERROR_TYPE_WARNING, " disconnecting client's context NULL\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " disconnecting client's context NULL\n");
}
return;
}
uint32_t *p;
unsigned int i;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "\n");
- LOG (GNUNET_ERROR_TYPE_INFO, "new client registering %p\n", client);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "new client registering %p\n", client);
/* Check data sanity */
size = ntohs (message->size);
return;
}
- LOG (GNUNET_ERROR_TYPE_INFO, " client %u has %u ports\n", c-> id, size);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " client %u has %u ports\n", c-> id, size);
if (size > 0)
{
uint32_t u32;
for (i = 0; i < size; i++)
{
u32 = ntohl (p[i]);
- LOG (GNUNET_ERROR_TYPE_INFO, " port: %u\n", u32);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " port: %u\n", u32);
/* store in client's hashmap */
GNUNET_CONTAINER_multihashmap32_put (c->ports, u32, c,
/* Retrieve tunnel */
chid = ntohl (msg->channel_id);
- LOG (GNUNET_ERROR_TYPE_DEBUG, " for channel %X\n", chid);
ch = GML_channel_get (c, chid);
+
+ LOG (GNUNET_ERROR_TYPE_INFO, "Client %u is destroying channel %X\n",
+ c->id, chid);
+
if (NULL == ch)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, " channel %X not found\n", chid);
+ LOG (GNUNET_ERROR_TYPE_WARNING, " channel %X not found\n", chid);
GNUNET_STATISTICS_update (stats,
"# client destroy messages on unknown channel",
1, GNUNET_NO);
GNUNET_SERVER_notification_context_unicast (nc, c->handle,
&resp->header, GNUNET_NO);
- LOG (GNUNET_ERROR_TYPE_INFO, "Show peer request from client %u completed.\n");
+ LOG (GNUNET_ERROR_TYPE_INFO, "Show peer from client %u completed.\n", c->id);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
iter_channel (void *cls, struct CadetChannel *ch)
{
struct GNUNET_CADET_LocalInfoTunnel *msg = cls;
- struct GNUNET_HashCode *h = (struct GNUNET_HashCode *) &msg[1];
+ struct GNUNET_CADET_Hash *h = (struct GNUNET_CADET_Hash *) &msg[1];
CADET_ChannelNumber *chn = (CADET_ChannelNumber *) &h[msg->connections];
chn[msg->channels] = htonl (GCCH_get_id (ch));
resp = GNUNET_malloc (size);
resp->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL);
resp->header.size = htons (size);
+ resp->destination = msg->peer;
+ /* Do not interleave with iterators, iter_channel needs conn in HBO */
GCT_iterate_connections (t, &iter_connection, resp);
GCT_iterate_channels (t, &iter_channel, resp);
- /* Do not interleave with iterators, iter_channel needs conn in HBO */
- resp->destination = msg->peer;
resp->connections = htonl (resp->connections);
resp->channels = htonl (resp->channels);
+ /* Do not interleave end */
resp->cstate = htons (GCT_get_cstate (t));
resp->estate = htons (GCT_get_estate (t));
GNUNET_SERVER_notification_context_unicast (nc, c->handle,
LOG (GNUNET_ERROR_TYPE_INFO, "Received dump info request from client %u\n",
c->id);
-
LOG (GNUNET_ERROR_TYPE_ERROR,
"*************************** DUMP START ***************************\n");
+ for (c = clients_head; NULL != c; c = c->next)
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR, "Client %u (%p), handle: %p\n",
+ c->id, c, c->handle);
+ if (NULL != c->ports)
+ LOG (GNUNET_ERROR_TYPE_ERROR, "\t%3u ports registered\n",
+ GNUNET_CONTAINER_multihashmap32_size (c->ports));
+ else
+ LOG (GNUNET_ERROR_TYPE_ERROR, "\t no ports registered\n");
+ LOG (GNUNET_ERROR_TYPE_ERROR, "\t%3u own channles\n",
+ GNUNET_CONTAINER_multihashmap32_size (c->own_channels));
+ LOG (GNUNET_ERROR_TYPE_ERROR, "\t%3u incoming channles\n",
+ GNUNET_CONTAINER_multihashmap32_size (c->incoming_channels));
+ }
+ LOG (GNUNET_ERROR_TYPE_ERROR, "***************************\n");
GCP_iterate_all (&show_peer_iterator, NULL);
LOG (GNUNET_ERROR_TYPE_ERROR,
{
struct CadetClient *c;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down local\n");
+
for (c = clients_head; NULL != clients_head; c = clients_head)
client_destroy (c);
struct CadetClient *
GML_client_get (struct GNUNET_SERVER_Client *client)
{
+ if (NULL == client)
+ return NULL;
return GNUNET_SERVER_client_get_user_context (client, struct CadetClient);
}