gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29744 - gnunet/src/dv


From: gnunet
Subject: [GNUnet-SVN] r29744 - gnunet/src/dv
Date: Tue, 1 Oct 2013 09:16:13 +0200

Author: grothoff
Date: 2013-10-01 09:16:13 +0200 (Tue, 01 Oct 2013)
New Revision: 29744

Modified:
   gnunet/src/dv/dv_api.c
   gnunet/src/dv/gnunet-service-dv.c
   gnunet/src/dv/plugin_transport_dv.c
Log:
-fix ftbfs

Modified: gnunet/src/dv/dv_api.c
===================================================================
--- gnunet/src/dv/dv_api.c      2013-10-01 06:52:03 UTC (rev 29743)
+++ gnunet/src/dv/dv_api.c      2013-10-01 07:16:13 UTC (rev 29744)
@@ -143,7 +143,7 @@
    * upon successful transmission.  The respective
    * transmissions have already been done.
    */
-  struct GNUNET_CONTAINER_MultiHashMap *send_callbacks;
+  struct GNUNET_CONTAINER_MultiPeerMap *send_callbacks;
 
   /**
    * Current unique ID
@@ -196,8 +196,8 @@
     ret += tsize;
     if (NULL != th->cb)
     {
-      (void) GNUNET_CONTAINER_multihashmap_put (sh->send_callbacks,
-                                               &th->target.hashPubKey,
+      (void) GNUNET_CONTAINER_multipeermap_put (sh->send_callbacks,
+                                               &th->target,
                                                th,
                                                
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
     }
@@ -259,7 +259,7 @@
  */
 static int
 process_ack (void *cls,
-            const struct GNUNET_HashCode *key,
+            const struct GNUNET_PeerIdentity *key,
             void *value)
 {
   struct AckContext *ctx = cls;
@@ -269,9 +269,9 @@
     return GNUNET_OK;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Matchedk ACK for message to peer %s\n",
-       GNUNET_h2s (key));
+       GNUNET_i2s (key));
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_remove (ctx->sh->send_callbacks,
+                GNUNET_CONTAINER_multipeermap_remove (ctx->sh->send_callbacks,
                                                       key,
                                                       th));
   th->cb (th->cb_cls,
@@ -380,8 +380,8 @@
     ack = (const struct GNUNET_DV_AckMessage *) msg;
     ctx.ack = ack;
     ctx.sh = sh;
-    GNUNET_CONTAINER_multihashmap_get_multiple (sh->send_callbacks,
-                                               &ack->target.hashPubKey,
+    GNUNET_CONTAINER_multipeermap_get_multiple (sh->send_callbacks,
+                                               &ack->target,
                                                &process_ack,
                                                &ctx);
     break;
@@ -441,14 +441,14 @@
  */
 static int
 cleanup_send_cb (void *cls,
-                const struct GNUNET_HashCode *key,
+                const struct GNUNET_PeerIdentity *key,
                 void *value)
 {
   struct GNUNET_DV_ServiceHandle *sh = cls;
   struct GNUNET_DV_TransmitHandle *th = value;
 
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_remove (sh->send_callbacks,
+                GNUNET_CONTAINER_multipeermap_remove (sh->send_callbacks,
                                                       key,
                                                       th));
   th->cb (th->cb_cls, GNUNET_SYSERR);
@@ -475,7 +475,7 @@
     GNUNET_CLIENT_disconnect (sh->client);
     sh->client = NULL;
   }
-  GNUNET_CONTAINER_multihashmap_iterate (sh->send_callbacks,
+  GNUNET_CONTAINER_multipeermap_iterate (sh->send_callbacks,
                                         &cleanup_send_cb,
                                         sh);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -523,7 +523,7 @@
   sh->distance_cb = distance_cb;
   sh->disconnect_cb = disconnect_cb;
   sh->message_cb = message_cb;
-  sh->send_callbacks = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_YES);
+  sh->send_callbacks = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_YES);
   reconnect (sh);
   return sh;
 }
@@ -558,10 +558,10 @@
     GNUNET_CLIENT_disconnect (sh->client);
     sh->client = NULL;
   }
-  GNUNET_CONTAINER_multihashmap_iterate (sh->send_callbacks,
+  GNUNET_CONTAINER_multipeermap_iterate (sh->send_callbacks,
                                         &cleanup_send_cb,
                                         sh);
-  GNUNET_CONTAINER_multihashmap_destroy (sh->send_callbacks);
+  GNUNET_CONTAINER_multipeermap_destroy (sh->send_callbacks);
   GNUNET_free (sh);
 }
 
@@ -637,8 +637,8 @@
   struct GNUNET_DV_ServiceHandle *sh = th->sh;
   int ret;
 
-  ret = GNUNET_CONTAINER_multihashmap_remove (sh->send_callbacks,
-                                             &th->target.hashPubKey,
+  ret = GNUNET_CONTAINER_multipeermap_remove (sh->send_callbacks,
+                                             &th->target,
                                              th);
   if (GNUNET_YES != ret)
     GNUNET_CONTAINER_DLL_remove (sh->th_head,

Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c   2013-10-01 06:52:03 UTC (rev 29743)
+++ gnunet/src/dv/gnunet-service-dv.c   2013-10-01 07:16:13 UTC (rev 29744)
@@ -198,7 +198,7 @@
    * Note that the distances in the targets are from the point-of-view
    * of the peer, not from us!
    */ 
-  struct GNUNET_CONTAINER_MultiHashMap *neighbor_table;
+  struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table;
 
   /**
    * Updated routing table of the neighbor, under construction,
@@ -207,7 +207,7 @@
    * Note that the distances in the targets are from the point-of-view
    * of the peer, not from us!
    */ 
-  struct GNUNET_CONTAINER_MultiHashMap *neighbor_table_consensus;
+  struct GNUNET_CONTAINER_MultiPeerMap *neighbor_table_consensus;
 
   /**
    * Our current (exposed) routing table as a set.
@@ -317,18 +317,18 @@
 
 
 /**
- * Hashmap of all of our neighbors; processing these usually requires
+ * Peermap of all of our neighbors; processing these usually requires
  * first checking to see if the peer is core-connected and if the 
  * distance is 1, in which case they are direct neighbors.
  */
-static struct GNUNET_CONTAINER_MultiHashMap *direct_neighbors;
+static struct GNUNET_CONTAINER_MultiPeerMap *direct_neighbors;
 
 /**
  * Hashmap with all routes that we currently support; contains 
  * routing information for all peers from distance 2
  * up to distance DEFAULT_FISHEYE_DEPTH.
  */
-static struct GNUNET_CONTAINER_MultiHashMap *all_routes;
+static struct GNUNET_CONTAINER_MultiPeerMap *all_routes;
 
 /**
  * Array of consensus sets we expose to the outside world.  Sets
@@ -804,6 +804,8 @@
 handle_direct_connect (struct DirectNeighbor *neighbor)
 {
   struct Route *route;
+  struct GNUNET_HashCode h1;
+  struct GNUNET_HashCode h2;
   struct GNUNET_HashCode session_id;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -812,8 +814,8 @@
   GNUNET_STATISTICS_update (stats,
                            "# peers connected (1-hop)",
                            1, GNUNET_NO);
-  route = GNUNET_CONTAINER_multihashmap_get (all_routes, 
-                                            &neighbor->peer.hashPubKey);
+  route = GNUNET_CONTAINER_multipeermap_get (all_routes, 
+                                            &neighbor->peer);
   if (NULL != route)  
   {
     send_disconnect_to_plugin (&neighbor->peer);
@@ -821,8 +823,10 @@
     GNUNET_free (route);
   }
   /* construct session ID seed as XOR of both peer's identities */
-  GNUNET_CRYPTO_hash_xor (&my_identity.hashPubKey, 
-                         &neighbor->peer.hashPubKey, 
+  GNUNET_CRYPTO_hash (&my_identity, sizeof (my_identity), &h1);
+  GNUNET_CRYPTO_hash (&neighbor->peer, sizeof (struct GNUNET_PeerIdentity), 
&h2);
+  GNUNET_CRYPTO_hash_xor (&h1,
+                         &h2,
                          &session_id);
   /* make sure session ID is unique across applications by salting it with 
'DV' */
   GNUNET_CRYPTO_hkdf (&neighbor->real_session_id, sizeof (struct 
GNUNET_HashCode),
@@ -830,8 +834,9 @@
                      "DV-SALT", 2,
                      &session_id, sizeof (session_id),
                      NULL, 0);
-  if (1 == GNUNET_CRYPTO_hash_cmp (&neighbor->peer.hashPubKey,
-                                  &my_identity.hashPubKey))  
+  if (0 < memcmp (&neighbor->peer,
+                 &my_identity,
+                 sizeof (struct GNUNET_PeerIdentity)))
   {
     neighbor->initiate_task = GNUNET_SCHEDULER_add_now (&initiate_set_union,
                                                        neighbor);  
@@ -865,8 +870,8 @@
   if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
     return;
   /* check if entry exists */
-  neighbor = GNUNET_CONTAINER_multihashmap_get (direct_neighbors, 
-                                               &peer->hashPubKey);
+  neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, 
+                                               peer);
   if (NULL != neighbor)
   {
     GNUNET_break (GNUNET_YES != neighbor->connected);
@@ -886,8 +891,8 @@
   neighbor = GNUNET_new (struct DirectNeighbor);
   neighbor->peer = *peer;
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_put (direct_neighbors,
-                                                   &peer->hashPubKey,
+                GNUNET_CONTAINER_multipeermap_put (direct_neighbors,
+                                                   peer,
                                                    neighbor,
                                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   neighbor->connected = GNUNET_YES;
@@ -905,7 +910,7 @@
  */
 static int
 free_targets (void *cls,
-             const struct GNUNET_HashCode *key,
+             const struct GNUNET_PeerIdentity *key,
              void *value)
 {
   GNUNET_free (value);
@@ -914,7 +919,7 @@
 
 
 /**
- * Multihashmap iterator for checking if a given route is
+ * Multipeerhmap iterator for checking if a given route is
  * (now) useful to this peer.
  *
  * @param cls the direct neighbor for the given route
@@ -925,14 +930,14 @@
  */
 static int
 check_possible_route (void *cls, 
-                     const struct GNUNET_HashCode *key, 
+                     const struct GNUNET_PeerIdentity *key, 
                      void *value)
 {
   struct DirectNeighbor *neighbor = cls;
   struct Target *target = value;
   struct Route *route;
   
-  route = GNUNET_CONTAINER_multihashmap_get (all_routes,
+  route = GNUNET_CONTAINER_multipeermap_get (all_routes,
                                             key);
   if (NULL != route)
   {
@@ -951,8 +956,8 @@
   route->target.peer = target->peer;
   allocate_route (route, ntohl (route->target.distance));
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_put (all_routes,
-                                                   
&route->target.peer.hashPubKey,
+                GNUNET_CONTAINER_multipeermap_put (all_routes,
+                                                   &route->target.peer,
                                                    route,
                                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   send_connect_to_plugin (&route->target.peer, ntohl (target->distance));
@@ -961,7 +966,7 @@
 
 
 /**
- * Multihashmap iterator for finding routes that were previously
+ * Multipeermap iterator for finding routes that were previously
  * "hidden" due to a better route (called after a disconnect event).
  *
  * @param cls NULL
@@ -971,7 +976,7 @@
  */
 static int
 refresh_routes (void *cls, 
-               const struct GNUNET_HashCode *key, 
+               const struct GNUNET_PeerIdentity *key, 
                void *value)
 {
   struct DirectNeighbor *neighbor = value;
@@ -980,7 +985,7 @@
        (DIRECT_NEIGHBOR_COST != neighbor->distance) )
     return GNUNET_YES;    
   if (NULL != neighbor->neighbor_table)
-    GNUNET_CONTAINER_multihashmap_iterate (neighbor->neighbor_table,
+    GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table,
                                           &check_possible_route,
                                           neighbor);
   return GNUNET_YES;
@@ -1009,7 +1014,7 @@
 
 
 /**
- * Multihashmap iterator for freeing routes that go via a particular
+ * Multipeermap iterator for freeing routes that go via a particular
  * neighbor that disconnected and is thus no longer available.
  *
  * @param cls the direct neighbor that is now unavailable
@@ -1020,7 +1025,7 @@
  */
 static int
 cull_routes (void *cls, 
-            const struct GNUNET_HashCode *key, 
+            const struct GNUNET_PeerIdentity *key, 
             void *value)
 {
   struct DirectNeighbor *neighbor = cls;
@@ -1029,7 +1034,7 @@
   if (route->next_hop != neighbor)
     return GNUNET_YES; /* not affected */
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_remove (all_routes, key, value));
+                GNUNET_CONTAINER_multipeermap_remove (all_routes, key, value));
   release_route (route);
   send_disconnect_to_plugin (&route->target.peer);
   GNUNET_free (route);
@@ -1048,7 +1053,7 @@
 static void
 handle_direct_disconnect (struct DirectNeighbor *neighbor)
 {
-  GNUNET_CONTAINER_multihashmap_iterate (all_routes,
+  GNUNET_CONTAINER_multipeermap_iterate (all_routes,
                                         &cull_routes,
                                          neighbor);
   if (NULL != neighbor->cth)
@@ -1058,18 +1063,18 @@
   }
   if (NULL != neighbor->neighbor_table_consensus)
   {
-    GNUNET_CONTAINER_multihashmap_iterate (neighbor->neighbor_table_consensus,
+    GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table_consensus,
                                           &free_targets,
                                           NULL);
-    GNUNET_CONTAINER_multihashmap_destroy (neighbor->neighbor_table_consensus);
+    GNUNET_CONTAINER_multipeermap_destroy (neighbor->neighbor_table_consensus);
     neighbor->neighbor_table_consensus = NULL;
   }
   if (NULL != neighbor->neighbor_table)
   {
-    GNUNET_CONTAINER_multihashmap_iterate (neighbor->neighbor_table,
+    GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table,
                                           &free_targets,
                                           NULL);
-    GNUNET_CONTAINER_multihashmap_destroy (neighbor->neighbor_table);
+    GNUNET_CONTAINER_multipeermap_destroy (neighbor->neighbor_table);
     neighbor->neighbor_table = NULL;
   }
   if (NULL != neighbor->set_op)
@@ -1127,8 +1132,8 @@
              GNUNET_i2s (&address->peer),
              (unsigned int) distance);
   /* check if entry exists */
-  neighbor = GNUNET_CONTAINER_multihashmap_get (direct_neighbors, 
-                                               &address->peer.hashPubKey);
+  neighbor = GNUNET_CONTAINER_multipeermap_get (direct_neighbors, 
+                                               &address->peer);
   if (NULL != neighbor)
   {    
     if ( (DIRECT_NEIGHBOR_COST == neighbor->distance) &&
@@ -1141,7 +1146,7 @@
                                "# peers connected (1-hop)",
                                -1, GNUNET_NO);  
       handle_direct_disconnect (neighbor);
-      GNUNET_CONTAINER_multihashmap_iterate (direct_neighbors,
+      GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors,
                                             &refresh_routes,
                                             NULL);
       return;
@@ -1157,8 +1162,8 @@
   neighbor = GNUNET_new (struct DirectNeighbor);
   neighbor->peer = address->peer;
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_put (direct_neighbors,
-                                                   &address->peer.hashPubKey,
+                GNUNET_CONTAINER_multipeermap_put (direct_neighbors,
+                                                   &address->peer,
                                                    neighbor,
                                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   neighbor->connected = GNUNET_NO; /* not yet */
@@ -1177,19 +1182,19 @@
  */
 static int
 check_target_removed (void *cls,
-                     const struct GNUNET_HashCode *key,
+                     const struct GNUNET_PeerIdentity *key,
                      void *value)
 {
   struct DirectNeighbor *neighbor = cls;
   struct Target *new_target;
   struct Route *current_route;
 
-  new_target = GNUNET_CONTAINER_multihashmap_get 
(neighbor->neighbor_table_consensus,
+  new_target = GNUNET_CONTAINER_multipeermap_get 
(neighbor->neighbor_table_consensus,
                                                  key);
   if (NULL == new_target)
   {
     /* target was revoked, check if it was used */
-    current_route = GNUNET_CONTAINER_multihashmap_get (all_routes,
+    current_route = GNUNET_CONTAINER_multipeermap_get (all_routes,
                                                       key);
     if ( (NULL == current_route) ||
         (current_route->next_hop != neighbor) )
@@ -1202,7 +1207,7 @@
                "Lost route to %s\n",
                GNUNET_i2s (&current_route->target.peer));
     GNUNET_assert (GNUNET_YES ==
-                  GNUNET_CONTAINER_multihashmap_remove (all_routes, key, 
current_route));
+                  GNUNET_CONTAINER_multipeermap_remove (all_routes, key, 
current_route));
     send_disconnect_to_plugin (&current_route->target.peer);
     GNUNET_free (current_route);
     neighbor->target_removed = GNUNET_YES;
@@ -1222,7 +1227,7 @@
  */
 static int
 check_target_added (void *cls,
-                   const struct GNUNET_HashCode *key,
+                   const struct GNUNET_PeerIdentity *key,
                    void *value)
 {
   struct DirectNeighbor *neighbor = cls;
@@ -1230,7 +1235,7 @@
   struct Route *current_route;
 
   /* target was revoked, check if it was used */
-  current_route = GNUNET_CONTAINER_multihashmap_get (all_routes,
+  current_route = GNUNET_CONTAINER_multipeermap_get (all_routes,
                                                     key);
   if (NULL != current_route)
   {
@@ -1270,8 +1275,8 @@
   current_route->target.peer = target->peer;
   current_route->target.distance = htonl (ntohl (target->distance) + 1);
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_put (all_routes,
-                                                   
&current_route->target.peer.hashPubKey,
+                GNUNET_CONTAINER_multipeermap_put (all_routes,
+                                                   &current_route->target.peer,
                                                    current_route,
                                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   send_connect_to_plugin (&current_route->target.peer,
@@ -1312,8 +1317,8 @@
     target = GNUNET_new (struct Target);
     memcpy (target, element->data, sizeof (struct Target));
     if (GNUNET_YES !=
-       GNUNET_CONTAINER_multihashmap_put (neighbor->neighbor_table_consensus,
-                                          &target->peer.hashPubKey,
+       GNUNET_CONTAINER_multipeermap_put (neighbor->neighbor_table_consensus,
+                                          &target->peer,
                                           target,
                                           
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
     {
@@ -1328,14 +1333,15 @@
     neighbor->set_op = NULL;
     if (NULL != neighbor->neighbor_table_consensus)
     {
-      GNUNET_CONTAINER_multihashmap_iterate 
(neighbor->neighbor_table_consensus,
+      GNUNET_CONTAINER_multipeermap_iterate 
(neighbor->neighbor_table_consensus,
                                             &free_targets,
                                             NULL);
-      GNUNET_CONTAINER_multihashmap_destroy 
(neighbor->neighbor_table_consensus);
+      GNUNET_CONTAINER_multipeermap_destroy 
(neighbor->neighbor_table_consensus);
       neighbor->neighbor_table_consensus = NULL;
     }
-    if (1 == GNUNET_CRYPTO_hash_cmp (&neighbor->peer.hashPubKey,
-                                    &my_identity.hashPubKey))
+    if (0 < memcmp (&neighbor->peer,
+                   &my_identity,
+                   sizeof (struct GNUNET_PeerIdentity)))
       neighbor->initiate_task = GNUNET_SCHEDULER_add_delayed 
(GNUNET_DV_CONSENSUS_FREQUENCY,
                                                              
&initiate_set_union,
                                                              neighbor);
@@ -1343,26 +1349,26 @@
   case GNUNET_SET_STATUS_HALF_DONE:
     /* we got all of our updates; integrate routing table! */
     neighbor->target_removed = GNUNET_NO;
-    GNUNET_CONTAINER_multihashmap_iterate (neighbor->neighbor_table,
+    GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table,
                                           &check_target_removed,
                                           neighbor);
     if (GNUNET_YES == neighbor->target_removed)
     {
       /* check if we got an alternative for the removed routes */
-      GNUNET_CONTAINER_multihashmap_iterate (direct_neighbors,
+      GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors,
                                             &refresh_routes,
                                             NULL);    
     }
     /* add targets that appeared (and check for improved routes) */
-    GNUNET_CONTAINER_multihashmap_iterate (neighbor->neighbor_table_consensus,
+    GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table_consensus,
                                           &check_target_added,
                                           neighbor);
     if (NULL != neighbor->neighbor_table)
     {
-      GNUNET_CONTAINER_multihashmap_iterate (neighbor->neighbor_table,
+      GNUNET_CONTAINER_multipeermap_iterate (neighbor->neighbor_table,
                                             &free_targets,
                                             NULL);
-      GNUNET_CONTAINER_multihashmap_destroy (neighbor->neighbor_table);
+      GNUNET_CONTAINER_multipeermap_destroy (neighbor->neighbor_table);
       neighbor->neighbor_table = NULL;
     }
     neighbor->neighbor_table = neighbor->neighbor_table_consensus;
@@ -1371,8 +1377,9 @@
   case GNUNET_SET_STATUS_DONE:
     /* operation done, schedule next run! */
     neighbor->set_op = NULL;
-    if (1 == GNUNET_CRYPTO_hash_cmp (&neighbor->peer.hashPubKey,
-                                    &my_identity.hashPubKey))
+    if (0 < memcmp (&neighbor->peer,
+                   &my_identity,
+                   sizeof (struct GNUNET_PeerIdentity)))
       neighbor->initiate_task = GNUNET_SCHEDULER_add_delayed 
(GNUNET_DV_CONSENSUS_FREQUENCY,
                                                              
&initiate_set_union,
                                                              neighbor);
@@ -1500,8 +1507,8 @@
                   sizeof (struct GNUNET_PeerIdentity)))
   {
     /* message is for me, check reverse route! */
-    route = GNUNET_CONTAINER_multihashmap_get (all_routes,
-                                              &rm->sender.hashPubKey);
+    route = GNUNET_CONTAINER_multipeermap_get (all_routes,
+                                              &rm->sender);
     if (NULL == route)
     {
       /* don't have reverse route, drop */
@@ -1518,8 +1525,8 @@
                         ntohl (route->target.distance));
     return GNUNET_OK;
   }
-  route = GNUNET_CONTAINER_multihashmap_get (all_routes,
-                                            &rm->target.hashPubKey);
+  route = GNUNET_CONTAINER_multipeermap_get (all_routes,
+                                            &rm->target);
   if (NULL == route)
   {
     GNUNET_STATISTICS_update (stats,
@@ -1578,8 +1585,8 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  route = GNUNET_CONTAINER_multihashmap_get (all_routes,
-                                            &msg->target.hashPubKey);
+  route = GNUNET_CONTAINER_multipeermap_get (all_routes,
+                                            &msg->target);
   if (NULL == route)
   {
     /* got disconnected */
@@ -1625,8 +1632,8 @@
   }
   handle_direct_disconnect (neighbor);
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_remove (direct_neighbors, 
-                                                      
&neighbor->peer.hashPubKey,
+                GNUNET_CONTAINER_multipeermap_remove (direct_neighbors, 
+                                                      &neighbor->peer,
                                                       neighbor));
   GNUNET_free (neighbor);
 }
@@ -1650,7 +1657,7 @@
   if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity)))
     return;
   neighbor =
-      GNUNET_CONTAINER_multihashmap_get (direct_neighbors, &peer->hashPubKey);
+      GNUNET_CONTAINER_multipeermap_get (direct_neighbors, peer);
   if (NULL == neighbor)
   {
     GNUNET_break (0);
@@ -1665,14 +1672,14 @@
                              -1, GNUNET_NO);  
   }
   cleanup_neighbor (neighbor);
-  GNUNET_CONTAINER_multihashmap_iterate (direct_neighbors,
+  GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors,
                                         &refresh_routes,
                                          NULL);
 }
 
 
 /**
- * Multihashmap iterator for freeing routes.  Should never be called.
+ * Multipeermap iterator for freeing routes.  Should never be called.
  *
  * @param cls NULL
  * @param key key value stored under
@@ -1681,13 +1688,13 @@
  * @return GNUNET_YES to continue iteration, GNUNET_NO to stop
  */
 static int
-free_route (void *cls, const struct GNUNET_HashCode * key, void *value)
+free_route (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
 {
   struct Route *route = value;
 
   GNUNET_break (0);
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_remove (all_routes, key, value));
+                GNUNET_CONTAINER_multipeermap_remove (all_routes, key, value));
   release_route (route);
   send_disconnect_to_plugin (&route->target.peer);
   GNUNET_free (route);
@@ -1696,7 +1703,7 @@
 
 
 /**
- * Multihashmap iterator for freeing direct neighbors. Should never be called.
+ * Multipeermap iterator for freeing direct neighbors. Should never be called.
  *
  * @param cls NULL
  * @param key key value stored under
@@ -1705,7 +1712,7 @@
  * @return GNUNET_YES to continue iteration, GNUNET_NO to stop
  */
 static int
-free_direct_neighbors (void *cls, const struct GNUNET_HashCode * key, void 
*value)
+free_direct_neighbors (void *cls, const struct GNUNET_PeerIdentity * key, void 
*value)
 {
   struct DirectNeighbor *neighbor = value;
 
@@ -1730,12 +1737,12 @@
   core_api = NULL;
   GNUNET_ATS_performance_done (ats);
   ats = NULL;
-  GNUNET_CONTAINER_multihashmap_iterate (direct_neighbors,
+  GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors,
                                          &free_direct_neighbors, NULL);
-  GNUNET_CONTAINER_multihashmap_iterate (all_routes,
+  GNUNET_CONTAINER_multipeermap_iterate (all_routes,
                                          &free_route, NULL);
-  GNUNET_CONTAINER_multihashmap_destroy (direct_neighbors);
-  GNUNET_CONTAINER_multihashmap_destroy (all_routes);
+  GNUNET_CONTAINER_multipeermap_destroy (direct_neighbors);
+  GNUNET_CONTAINER_multipeermap_destroy (all_routes);
   GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
   stats = NULL;
   GNUNET_SERVER_notification_context_destroy (nc);
@@ -1757,7 +1764,7 @@
  */
 static int
 add_route (void *cls,
-          const struct GNUNET_HashCode *key,
+          const struct GNUNET_PeerIdentity *key,
           void *value)
 {
   struct GNUNET_SERVER_Client *client = cls;
@@ -1791,7 +1798,7 @@
 {
   GNUNET_SERVER_notification_context_add (nc, client);  
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
-  GNUNET_CONTAINER_multihashmap_iterate (all_routes,
+  GNUNET_CONTAINER_multipeermap_iterate (all_routes,
                                         &add_route,
                                         client);
 }
@@ -1840,8 +1847,8 @@
   };
 
   cfg = c;
-  direct_neighbors = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
-  all_routes = GNUNET_CONTAINER_multihashmap_create (65536, GNUNET_NO);
+  direct_neighbors = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
+  all_routes = GNUNET_CONTAINER_multipeermap_create (65536, GNUNET_NO);
   core_api = GNUNET_CORE_connect (cfg, NULL,
                                  &core_init, 
                                  &handle_core_connect,

Modified: gnunet/src/dv/plugin_transport_dv.c
===================================================================
--- gnunet/src/dv/plugin_transport_dv.c 2013-10-01 06:52:03 UTC (rev 29743)
+++ gnunet/src/dv/plugin_transport_dv.c 2013-10-01 07:16:13 UTC (rev 29744)
@@ -27,10 +27,8 @@
  */
 
 #include "platform.h"
+#include "gnunet_util_lib.h"
 #include "gnunet_protocols.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_service_lib.h"
 #include "gnunet_statistics_service.h"
 #include "gnunet_dv_service.h"
 #include "gnunet_transport_service.h"
@@ -146,7 +144,7 @@
   /**
    * Hash map of sessions (active and inactive).
    */
-  struct GNUNET_CONTAINER_MultiHashMap *sessions;
+  struct GNUNET_CONTAINER_MultiPeerMap *sessions;
 
   /**
    * Copy of the handler array where the closures are
@@ -236,8 +234,8 @@
   struct GNUNET_ATS_Information ats;
   struct Session *session;
 
-  session = GNUNET_CONTAINER_multihashmap_get (plugin->sessions,
-                                              &sender->hashPubKey);
+  session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
+                                              sender);
   if (NULL == session)    
   {
     GNUNET_break (0);
@@ -280,8 +278,8 @@
   struct Plugin *plugin = cls;
   struct Session *session;
 
-  session = GNUNET_CONTAINER_multihashmap_get (plugin->sessions,
-                                              &peer->hashPubKey);
+  session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
+                                              peer);
   if (NULL != session)    
   {
     GNUNET_break (0);
@@ -294,8 +292,8 @@
   session->sender = *peer;
   session->distance = distance;
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_put (plugin->sessions,
-                                                   &session->sender.hashPubKey,
+                GNUNET_CONTAINER_multipeermap_put (plugin->sessions,
+                                                   &session->sender,
                                                    session,
                                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
 }
@@ -316,8 +314,8 @@
   struct Plugin *plugin = cls;
   struct Session *session;
 
-  session = GNUNET_CONTAINER_multihashmap_get (plugin->sessions,
-                                              &peer->hashPubKey);
+  session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
+                                              peer);
   if (NULL == session)    
   {
     GNUNET_break (0);
@@ -342,8 +340,8 @@
   struct PendingRequest *pr;
 
   GNUNET_assert (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap_remove (plugin->sessions,
-                                                      
&session->sender.hashPubKey,
+                GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
+                                                      &session->sender,
                                                       session));
   if (GNUNET_YES == session->active)
     plugin->env->session_end (plugin->env->cls,
@@ -379,8 +377,8 @@
   struct Plugin *plugin = cls;
   struct Session *session;
 
-  session = GNUNET_CONTAINER_multihashmap_get (plugin->sessions,
-                                              &peer->hashPubKey);
+  session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
+                                              peer);
   if (NULL == session)    
     return; /* nothing to do */
   free_session (session);
@@ -486,8 +484,8 @@
   struct Session *session;
   struct PendingRequest *pr;
 
-  session = GNUNET_CONTAINER_multihashmap_get (plugin->sessions,
-                                              &target->hashPubKey);
+  session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
+                                              target);
   if (NULL == session)    
     return; /* nothing to do */  
   while (NULL != (pr = session->pr_head))
@@ -599,8 +597,8 @@
 
   if (0 != address->address_length)
     return NULL;
-  session = GNUNET_CONTAINER_multihashmap_get (plugin->sessions,
-                                              &address->peer.hashPubKey);
+  session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
+                                              &address->peer);
   if (NULL == session)
     return NULL; /* not valid right now */
   session->active = GNUNET_YES;
@@ -672,7 +670,7 @@
 
   plugin = GNUNET_new (struct Plugin);
   plugin->env = env;
-  plugin->sessions = GNUNET_CONTAINER_multihashmap_create (1024 * 8, 
GNUNET_YES);
+  plugin->sessions = GNUNET_CONTAINER_multipeermap_create (1024 * 8, 
GNUNET_YES);
   plugin->mst = GNUNET_SERVER_mst_create (&unbox_cb,
                                          plugin);
   plugin->dvh = GNUNET_DV_service_connect (env->cfg,
@@ -683,7 +681,7 @@
                                           &handle_dv_message_received);
   if (NULL == plugin->dvh)
   {
-    GNUNET_CONTAINER_multihashmap_destroy (plugin->sessions);
+    GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
     GNUNET_SERVER_mst_destroy (plugin->mst);    
     GNUNET_free (plugin);
     return NULL;
@@ -712,7 +710,7 @@
  */
 static int
 free_session_iterator (void *cls,
-                      const struct GNUNET_HashCode *key,
+                      const struct GNUNET_PeerIdentity *key,
                       void *value)
 {
   struct Session *session = value;
@@ -735,10 +733,10 @@
   struct Plugin *plugin = api->cls;
 
   GNUNET_DV_service_disconnect (plugin->dvh);
-  GNUNET_CONTAINER_multihashmap_iterate (plugin->sessions,
+  GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions,
                                         &free_session_iterator,
                                         NULL);
-  GNUNET_CONTAINER_multihashmap_destroy (plugin->sessions);
+  GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
   GNUNET_SERVER_mst_destroy (plugin->mst);    
   GNUNET_free (plugin);
   GNUNET_free (api);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]