-log
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh_peer.c
index 44a9f7ed53317163160e9dc071b52b95d377dea3..28a53b088689c9db1af16b81c83f75f2699a263d 100644 (file)
@@ -276,18 +276,19 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
   struct MeshPeer *mp;
   struct MeshPeerPath *path;
+  char own_id[16];
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer connected\n");
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "     %s\n", GNUNET_i2s (&my_full_id));
+  strncpy (own_id, GNUNET_i2s (&my_full_id), 15);
   mp = GMP_get (peer);
   if (myid == mp->id)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "     (self)\n");
+    LOG (GNUNET_ERROR_TYPE_INFO, "CONNECTED %s (self)\n", own_id);
     path = path_new (1);
   }
   else
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "     %s\n", GNUNET_i2s (peer));
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "CONNECTED %s <= %s\n",
+         own_id, GNUNET_i2s (peer));
     path = path_new (2);
     path->peers[1] = mp->id;
     GNUNET_PEER_change_rc (mp->id, 1);
@@ -313,8 +314,9 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
   struct MeshPeer *p;
   struct MeshPeerPath *direct_path;
+  char own_id[16];
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer disconnected\n");
+  strncpy (own_id, GNUNET_i2s (&my_full_id), 15);
   p = GNUNET_CONTAINER_multipeermap_get (peers, peer);
   if (NULL == p)
   {
@@ -322,10 +324,10 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
     return;
   }
   if (myid == p->id)
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "     (self: %s)\n", GMP_2s (p));
+    LOG (GNUNET_ERROR_TYPE_INFO, "DISCONNECTED %s (self)\n", own_id);
   else
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "     %s\n", GMP_2s (p));
-
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "DISCONNECTED %s <= %s\n",
+         own_id, GNUNET_i2s (peer));
   direct_path = pop_direct_path (p);
   GNUNET_CONTAINER_multihashmap_iterate (p->connections, &notify_broken, p);
   GNUNET_CONTAINER_multihashmap_destroy (p->connections);
@@ -1553,7 +1555,7 @@ GMP_add_connection (struct MeshPeer *peer,
        "peer %s ok, has %u connections.\n",
        GMP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections));
   result = GNUNET_CONTAINER_multihashmap_put (peer->connections,
-                                              GMC_get_id (c),
+                                              GMC_get_h (c),
                                               c,
                                               GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1610,7 +1612,7 @@ GMP_add_path (struct MeshPeer *peer, struct MeshPeerPath *path,
   {
     if (path->peers[l] == myid)
     {
-      LOG (GNUNET_ERROR_TYPE_DEBUG, "shortening path by %u\n", l);
+      LOG (GNUNET_ERROR_TYPE_DEBUG, " shortening path by %u\n", l);
       for (l2 = 0; l2 < path->length - l; l2++)
       {
         path->peers[l2] = path->peers[l + l2];
@@ -1622,7 +1624,7 @@ GMP_add_path (struct MeshPeer *peer, struct MeshPeerPath *path,
     }
   }
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u]\n", path->length);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, " final length: %u\n", path->length);
 
   l = path_get_length (path);
   if (0 == l)
@@ -1769,7 +1771,7 @@ GMP_remove_connection (struct MeshPeer *peer,
        GMP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections));
 
   return GNUNET_CONTAINER_multihashmap_remove (peer->connections,
-                                               GMC_get_id (c),
+                                               GMC_get_h (c),
                                                c);
 }