ats_ril: - removed some redundantly saved plugin environment attributes
[oweals/gnunet.git] / src / fs / gnunet-service-fs_mesh_client.c
index 5c3290d5ace2f91e71777762fc04909fe546350d..73ab6bb5d7c821e49b21dc791cd798b1fe2af358 100644 (file)
@@ -44,7 +44,7 @@
 #define CLIENT_RETRY_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
 
 
-/** 
+/**
  * Handle for a mesh to another peer.
  */
 struct MeshHandle;
@@ -99,7 +99,7 @@ struct GSF_MeshRequest
 };
 
 
-/** 
+/**
  * Handle for a mesh to another peer.
  */
 struct MeshHandle
@@ -127,12 +127,12 @@ struct MeshHandle
 
   /**
    * Handle for active write operation, or NULL.
-   */ 
+   */
   struct GNUNET_MESH_TransmitHandle *wh;
 
   /**
    * Which peer does this mesh go to?
-   */ 
+   */
   struct GNUNET_PeerIdentity target;
 
   /**
@@ -161,7 +161,7 @@ static struct GNUNET_MESH_Handle *mesh_handle;
  * Map from peer identities to 'struct MeshHandles' with mesh
  * tunnels to those peers.
  */
-static struct GNUNET_CONTAINER_MultiHashMap *mesh_map;
+static struct GNUNET_CONTAINER_MultiPeerMap *mesh_map;
 
 
 /* ********************* client-side code ************************* */
@@ -177,7 +177,7 @@ transmit_pending (struct MeshHandle *mh);
 
 
 /**
- * Iterator called on each entry in a waiting map to 
+ * Iterator called on each entry in a waiting map to
  * move it back to the pending list.
  *
  * @param cls the 'struct MeshHandle'
@@ -192,7 +192,7 @@ move_to_pending (void *cls,
 {
   struct MeshHandle *mh = cls;
   struct GSF_MeshRequest *sr = value;
-  
+
   GNUNET_assert (GNUNET_YES ==
                 GNUNET_CONTAINER_multihashmap_remove (mh->waiting_map,
                                                       key,
@@ -224,7 +224,7 @@ reset_mesh (struct MeshHandle *mh)
                                          mh,
                                          &mh->target,
                                          GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
-                                         GNUNET_YES,
+                                         GNUNET_NO,
                                          GNUNET_YES);
   transmit_pending (mh);
 }
@@ -342,7 +342,7 @@ transmit_sqm (void *cls,
   transmit_pending (mh);
   return sizeof (sqm);
 }
-         
+       
 
 /**
  * Transmit pending requests via the mesh.
@@ -371,7 +371,7 @@ struct HandleReplyClosure
 
   /**
    * Reply payload.
-   */ 
+   */
   const void *data;
 
   /**
@@ -384,11 +384,11 @@ struct HandleReplyClosure
    */
   size_t data_size;
 
-  /** 
+  /**
    * Type of the block.
    */
   enum GNUNET_BLOCK_Type type;
-  
+
   /**
    * Did we have a matching query?
    */
@@ -397,7 +397,7 @@ struct HandleReplyClosure
 
 
 /**
- * Iterator called on each entry in a waiting map to 
+ * Iterator called on each entry in a waiting map to
  * process a result.
  *
  * @param cls the 'struct HandleReplyClosure'
@@ -412,7 +412,7 @@ handle_reply (void *cls,
 {
   struct HandleReplyClosure *hrc = cls;
   struct GSF_MeshRequest *sr = value;
-  
+
   sr->proc (sr->proc_cls,
            hrc->type,
            hrc->expiration,
@@ -462,7 +462,7 @@ reply_cb (void *cls,
                            type,
                            &srm[1], msize, &query))
   {
-    GNUNET_break_op (0); 
+    GNUNET_break_op (0);
     reset_mesh_async (mh);
     return GNUNET_SYSERR;
   }
@@ -504,8 +504,8 @@ get_mesh (const struct GNUNET_PeerIdentity *target)
 {
   struct MeshHandle *mh;
 
-  mh = GNUNET_CONTAINER_multihashmap_get (mesh_map,
-                                         &target->hashPubKey);
+  mh = GNUNET_CONTAINER_multipeermap_get (mesh_map,
+                                         target);
   if (NULL != mh)
   {
     if (GNUNET_SCHEDULER_NO_TASK != mh->timeout_task)
@@ -528,11 +528,11 @@ get_mesh (const struct GNUNET_PeerIdentity *target)
                                          mh,
                                          &mh->target,
                                          GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
-                                         GNUNET_YES,
+                                         GNUNET_NO,
                                          GNUNET_YES);
   GNUNET_assert (GNUNET_OK ==
-                GNUNET_CONTAINER_multihashmap_put (mesh_map,
-                                                   &mh->target.hashPubKey,
+                GNUNET_CONTAINER_multipeermap_put (mesh_map,
+                                                   &mh->target,
                                                    mh,
                                                    GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   return mh;
@@ -611,7 +611,7 @@ GSF_mesh_query_cancel (struct GSF_MeshRequest *sr)
 
 
 /**
- * Iterator called on each entry in a waiting map to 
+ * Iterator called on each entry in a waiting map to
  * call the 'proc' continuation and release associated
  * resources.
  *
@@ -641,7 +641,7 @@ free_waiting_entry (void *cls,
  *
  * @param cls NULL
  * @param tunnel tunnel of the disconnecting client
- * @param tunnel_ctx our 'struct MeshClient' 
+ * @param tunnel_ctx our 'struct MeshClient'
  */
 static void
 cleaner_cb (void *cls,
@@ -669,8 +669,8 @@ cleaner_cb (void *cls,
   if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task)
     GNUNET_SCHEDULER_cancel (mh->reset_task);
   GNUNET_assert (GNUNET_OK ==
-                GNUNET_CONTAINER_multihashmap_remove (mesh_map,
-                                                      &mh->target.hashPubKey,
+                GNUNET_CONTAINER_multipeermap_remove (mesh_map,
+                                                      &mh->target,
                                                       mh));
   GNUNET_CONTAINER_multihashmap_destroy (mh->waiting_map);
   GNUNET_free (mh);
@@ -688,7 +688,7 @@ GSF_mesh_start_client ()
     { NULL, 0, 0 }
   };
 
-  mesh_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES);
+  mesh_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
   mesh_handle = GNUNET_MESH_connect (GSF_cfg,
                                     NULL,
                                     NULL,
@@ -708,7 +708,7 @@ GSF_mesh_start_client ()
  */
 static int
 release_meshs (void *cls,
-              const struct GNUNET_HashCode *key,
+              const struct GNUNET_PeerIdentity *key,
               void *value)
 {
   struct MeshHandle *mh = value;
@@ -731,10 +731,10 @@ release_meshs (void *cls,
 void
 GSF_mesh_stop_client ()
 {
-  GNUNET_CONTAINER_multihashmap_iterate (mesh_map,
+  GNUNET_CONTAINER_multipeermap_iterate (mesh_map,
                                         &release_meshs,
                                         NULL);
-  GNUNET_CONTAINER_multihashmap_destroy (mesh_map);
+  GNUNET_CONTAINER_multipeermap_destroy (mesh_map);
   mesh_map = NULL;
   if (NULL != mesh_handle)
   {