-remove trailing whitespace
[oweals/gnunet.git] / src / core / gnunet-service-core_neighbours.c
index ea1cca7d637a91fa6c017b8f4a7bec52c3ab41c5..6eff065d92f6421d582615f7e5ac5f6fd61943d4 100644 (file)
@@ -111,7 +111,7 @@ struct Neighbour
 /**
  * Map of peer identities to 'struct Neighbour'.
  */
-static struct GNUNET_CONTAINER_MultiHashMap *neighbours;
+static struct GNUNET_CONTAINER_MultiPeerMap *neighbours;
 
 /**
  * Transport service.
@@ -131,7 +131,7 @@ find_neighbour (const struct GNUNET_PeerIdentity *peer)
 {
   if (NULL == neighbours)
     return NULL;
-  return GNUNET_CONTAINER_multihashmap_get (neighbours, &peer->hashPubKey);
+  return GNUNET_CONTAINER_multipeermap_get (neighbours, peer);
 }
 
 
@@ -173,11 +173,11 @@ free_neighbour (struct Neighbour *n)
     n->retry_plaintext_task = GNUNET_SCHEDULER_NO_TASK;
   }
   GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multihashmap_remove (neighbours,
-                                                       &n->peer.hashPubKey, n));
+                 GNUNET_CONTAINER_multipeermap_remove (neighbours,
+                                                       &n->peer, n));
   GNUNET_STATISTICS_set (GSC_stats,
                          gettext_noop ("# neighbour entries allocated"),
-                         GNUNET_CONTAINER_multihashmap_size (neighbours),
+                         GNUNET_CONTAINER_multipeermap_size (neighbours),
                          GNUNET_NO);
   GNUNET_free (n);
 }
@@ -297,8 +297,6 @@ process_queue (struct Neighbour *n)
  *
  * @param cls closure
  * @param peer the peer that connected
- * @param atsi performance data
- * @param atsi_count number of entries in ats (excluding 0-termination)
  */
 static void
 handle_transport_notify_connect (void *cls,
@@ -323,12 +321,12 @@ handle_transport_notify_connect (void *cls,
   n = GNUNET_malloc (sizeof (struct Neighbour));
   n->peer = *peer;
   GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multihashmap_put (neighbours,
-                                                    &n->peer.hashPubKey, n,
+                 GNUNET_CONTAINER_multipeermap_put (neighbours,
+                                                    &n->peer, n,
                                                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   GNUNET_STATISTICS_set (GSC_stats,
                          gettext_noop ("# neighbour entries allocated"),
-                         GNUNET_CONTAINER_multihashmap_size (neighbours),
+                         GNUNET_CONTAINER_multipeermap_size (neighbours),
                          GNUNET_NO);
   n->kxinfo = GSC_KX_start (peer);
 }
@@ -366,8 +364,6 @@ handle_transport_notify_disconnect (void *cls,
  * @param cls closure
  * @param peer (claimed) identity of the other peer
  * @param message the message
- * @param atsi performance data
- * @param atsi_count number of entries in ats (excluding 0-termination)
  */
 static void
 handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
@@ -410,7 +406,7 @@ handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
     /*  Dummy messages for testing / benchmarking, just discard */
     break;
   default:
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 _
                 ("Unsupported message of type %u (%u bytes) received from peer `%s'\n"),
                 (unsigned int) type, (unsigned int) ntohs (message->size),
@@ -458,7 +454,7 @@ GSC_NEIGHBOURS_transmit (const struct GNUNET_PeerIdentity *target,
 int
 GSC_NEIGHBOURS_init ()
 {
-  neighbours = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
+  neighbours = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
   transport =
       GNUNET_TRANSPORT_connect (GSC_cfg, &GSC_my_identity, NULL,
                                 &handle_transport_receive,
@@ -466,7 +462,7 @@ GSC_NEIGHBOURS_init ()
                                 &handle_transport_notify_disconnect);
   if (NULL == transport)
   {
-    GNUNET_CONTAINER_multihashmap_destroy (neighbours);
+    GNUNET_CONTAINER_multipeermap_destroy (neighbours);
     neighbours = NULL;
     return GNUNET_SYSERR;
   }
@@ -483,7 +479,9 @@ GSC_NEIGHBOURS_init ()
  * @return GNUNET_OK (continue to iterate)
  */
 static int
-free_neighbour_helper (void *cls, const struct GNUNET_HashCode * key, void *value)
+free_neighbour_helper (void *cls,
+                      const struct GNUNET_PeerIdentity * key,
+                      void *value)
 {
   struct Neighbour *n = value;
 
@@ -507,9 +505,9 @@ GSC_NEIGHBOURS_done ()
   }
   if (NULL != neighbours)
   {
-    GNUNET_CONTAINER_multihashmap_iterate (neighbours, &free_neighbour_helper,
+    GNUNET_CONTAINER_multipeermap_iterate (neighbours, &free_neighbour_helper,
                                           NULL);
-    GNUNET_CONTAINER_multihashmap_destroy (neighbours);
+    GNUNET_CONTAINER_multipeermap_destroy (neighbours);
     neighbours = NULL;
   }
 }