* (and will be tricky to have during path changes)
*/
#include "platform.h"
+#include "gnunet-service-cadet-new_connection.h"
#include "gnunet-service-cadet-new_peer.h"
#include "gnunet-service-cadet-new_paths.h"
{
struct CadetPeerPathEntry *entry;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding connection %s to path %s at offset %u\n",
+ GCC_2s (cc),
+ GCPP_2s (path),
+ off);
GNUNET_assert (off < path->entries_length);
entry = &path->entries[off];
GNUNET_assert (NULL == entry->cc);
{
struct CadetPeerPathEntry *entry;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Removing connection %s to path %s at offset %u\n",
+ GCC_2s (cc),
+ GCPP_2s (path),
+ off);
GNUNET_assert (off < path->entries_length);
entry = &path->entries[off];
GNUNET_assert (cc == entry->cc);
static void
path_destroy (struct CadetPeerPath *path)
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Destroying path %s\n",
+ GCPP_2s (path));
GNUNET_assert (0 ==
GNUNET_CONTAINER_multipeermap_size (path->connections));
GNUNET_CONTAINER_multipeermap_destroy (path->connections);
{
struct CadetPeerPathEntry *entry;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Owner releases path %s\n",
+ GCPP_2s (path));
path->hn = NULL;
entry = &path->entries[path->entries_length - 1];
while (1)
entry,
old_len + i);
}
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Extended path %s\n",
+ GCPP_2s (path));
}
if (i == get_path_length + put_path_length - 1)
{
/* Existing path includes this one, nothing to do! */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Path discovered from DHT is already known\n");
return;
}
if (cm_ctx.match->entries_length == i + 1)
{
/* Existing path ends in the middle of new path, extend it! */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Trying to extend existing path %s by additional links discovered from DHT\n",
+ GCPP_2s (cm_ctx.match));
extend_path (cm_ctx.match,
&cpath[i],
get_path_length + put_path_length - i,
if (NULL == hn)
{
/* None of the peers on the path care about it. */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Path discovered from DHT is not interesting to us\n");
GNUNET_free (path);
return;
}
entry,
i);
}
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Created new path %s based on information from DHT\n",
+ GCPP_2s (path));
}
if (i == path_length - 1)
{
/* Existing path includes this one, return the match! */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Returning existing path %s as inverse for incoming connection\n",
+ GCPP_2s (cm_ctx.match));
return cm_ctx.match;
}
if (cm_ctx.match->entries_length == i + 1)
{
/* Existing path ends in the middle of new path, extend it! */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Extending existing path %s to create inverse for incoming connection\n",
+ GCPP_2s (cm_ctx.match));
extend_path (cm_ctx.match,
&cpath[i],
path_length - i,
path,
path_length - 1,
GNUNET_YES);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Created new path %s to create inverse for incoming connection\n",
+ GCPP_2s (path));
return path;
}
GNUNET_asprintf (&s,
"%s %s",
old,
- GCP_2s (GCPP_get_peer_at_offset (path,
- i)));
+ GNUNET_i2s (GCP_get_id (GCPP_get_peer_at_offset (path,
+ i))));
GNUNET_free_non_null (old);
old = s;
}
-
/*
This file is part of GNUnet.
Copyright (C) 2001-2017 GNUnet e.V.
*/
#include "platform.h"
#include "gnunet_util_lib.h"
+#include "gnunet_hello_lib.h"
#include "gnunet_signatures.h"
#include "gnunet_transport_service.h"
#include "gnunet_ats_service.h"
const char *
GCP_2s (const struct CadetPeer *peer)
{
- if (NULL == peer)
- return "PEER(NULL)";
- return GNUNET_i2s (&peer->pid);
+ static char buf[64];
+
+ GNUNET_snprintf (buf,
+ sizeof (buf),
+ "P(%s)",
+ GNUNET_i2s (&peer->pid));
+ return buf;
}
{
struct CadetPeer *cp = cls;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Destroying state about peer %s\n",
+ GCP_2s (cp));
cp->destroy_task = NULL;
GNUNET_assert (NULL == cp->t);
GNUNET_assert (NULL == cp->core_mq);
GCP_set_mq (struct CadetPeer *cp,
struct GNUNET_MQ_Handle *mq)
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Message queue for peer %s is now %p\n",
+ GCP_2s (cp),
+ mq);
cp->core_mq = mq;
for (struct GCP_MessageQueueManager *mqm = cp->mqm_head;
{
struct CadetPeer *cp = mqm->cp;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending to peer %s from MQM %p\n",
+ GCP_2s (cp),
+ mqm);
/* Move entry to the end of the DLL, to be fair. */
if (mqm != cp->mqm_tail)
{
{
struct CadetPeer *cp = cls;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending to peer %s completed\n",
+ GCP_2s (cp));
if (0 == cp->mqm_ready_counter)
return; /* nothing to do */
for (struct GCP_MessageQueueManager *mqm = cp->mqm_head;
{
struct CadetPeer *cp = mqm->cp;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Queueing message to peer %s in MQM %p\n",
+ GCP_2s (cp),
+ mqm);
GNUNET_assert (NULL != cp->core_mq);
GNUNET_assert (NULL == mqm->env);
GNUNET_MQ_notify_sent (env,
void
GCP_destroy_all_peers ()
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Destroying all peers now\n");
GNUNET_CONTAINER_multipeermap_iterate (peers,
&destroy_iterator_cb,
NULL);
struct CadetPeerPathEntry *entry,
unsigned int off)
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Discovered that peer %s is on path %s at offset %u\n",
+ GCP_2s (cp),
+ GCPP_2s (entry->path),
+ off);
if (off >= cp->path_dll_length)
{
unsigned int len = cp->path_dll_length;
struct CadetPeerPathEntry *entry,
unsigned int off)
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Removing knowledge about peer %s beging on path %s at offset %u\n",
+ GCP_2s (cp),
+ GCPP_2s (entry->path),
+ off);
GNUNET_CONTAINER_DLL_remove (cp->path_heads[off],
cp->path_tails[off],
entry);
if ( (DESIRED_CONNECTIONS_PER_TUNNEL > cp->num_paths) &&
(desirability < root_desirability) )
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Decided to not attach path %p to peer %s due to undesirability\n",
+ GCPP_2s (path),
+ GCP_2s (cp));
return NULL;
+ }
}
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Attaching path %p to peer %s (%s)\n",
+ GCPP_2s (path),
+ GCP_2s (cp),
+ (GNUNET_NO == force) ? "desirable" : "forced");
+
/* Yes, we'd like to add this path, add to our heap */
hn = GNUNET_CONTAINER_heap_insert (cp->path_heap,
(void *) cp,
struct CadetPeerPath *path,
struct GNUNET_CONTAINER_HeapNode *hn)
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Detatching path %p from peer %s\n",
+ GCPP_2s (path),
+ GCP_2s (cp));
GNUNET_assert (path ==
GNUNET_CONTAINER_heap_remove_node (hn));
}
GCP_add_connection (struct CadetPeer *cp,
struct CadetConnection *cc)
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding connection %s to peer %s\n",
+ GCC_2s (cc),
+ GCP_2s (cp));
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multishortmap_put (cp->connections,
&GCC_get_id (cc)->connection_of_tunnel,
GCP_remove_connection (struct CadetPeer *cp,
struct CadetConnection *cc)
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Removing connection %s from peer %s\n",
+ GCC_2s (cc),
+ GCP_2s (cp));
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multishortmap_remove (cp->connections,
&GCC_get_id (cc)->connection_of_tunnel,
{
uint32_t strength;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Updating peer %s activation state (%u connections)%s%s\n",
+ GCP_2s (cp),
+ GNUNET_CONTAINER_multishortmap_size (cp->connections),
+ (NULL == cp->t) ? "" : " with tunnel",
+ (NULL == cp->core_mq) ? "" : " with CORE link");
if (NULL != cp->destroy_task)
{
/* It's active, do not destory! */
&cp->pid,
cp,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Creating peer %s\n",
+ GCP_2s (cp));
return cp;
}
{
struct GNUNET_HELLO_Message *mrg;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Got %u byte HELLO for peer %s\n",
+ (unsigned int) GNUNET_HELLO_size (hello),
+ GCP_2s (cp));
if (NULL != cp->hello_offer)
{
GNUNET_TRANSPORT_offer_hello_cancel (cp->hello_offer);
GCP_drop_tunnel (struct CadetPeer *cp,
struct CadetTunnel *t)
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Dropping tunnel %s to peer %s\n",
+ GCT_2s (t),
+ GCP_2s (cp));
GNUNET_assert (cp->t == t);
cp->t = NULL;
consider_peer_destroy (cp);
GNUNET_CONTAINER_DLL_insert (cp->mqm_head,
cp->mqm_tail,
mqm);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Creating MQM %p for peer %s\n",
+ mqm,
+ GCP_2s (cp));
if (NULL != cp->core_mq)
cb (cb_cls,
GNUNET_YES);
{
struct CadetPeer *cp = mqm->cp;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Destroying MQM %p for peer %s%s\n",
+ mqm,
+ GCP_2s (cp),
+ (NULL == last_env) ? "" : " with last ditch transmission");
if (NULL != mqm->env)
GNUNET_MQ_discard (mqm->env);
if (NULL != last_env)
GCP_send_ooo (struct CadetPeer *cp,
struct GNUNET_MQ_Envelope *env)
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending message to %s out of management\n",
+ GCP_2s (cp));
if (NULL == cp->core_mq)
{
GNUNET_MQ_discard (env);