Merge branch 'master' of ssh://gnunet.org/gnunet
[oweals/gnunet.git] / src / fs / gnunet-service-fs_push.c
index 1573bc160364867e493dbeba6f7000a2dcef81e5..21c598a72cefa9a1821370f752d3782da3792f6c 100644 (file)
@@ -224,6 +224,7 @@ transmit_content (struct MigrationReadyPeer *mrp,
   int ret;
 
   ppd = GSF_get_peer_performance_data_ (mrp->peer);
+  GNUNET_assert (NULL == mrp->env);
   mrp->env = GNUNET_MQ_msg_extra (msg,
                                  block->size,
                                  GNUNET_MESSAGE_TYPE_FS_PUT);
@@ -447,6 +448,7 @@ consider_gathering ()
  * @param type type of the content
  * @param priority priority of the content
  * @param anonymity anonymity-level for the content
+ * @param replication replication-level for the content
  * @param expiration expiration time for the content
  * @param uid unique identifier for the datum;
  *        maybe 0 if no unique identifier is available
@@ -459,6 +461,7 @@ process_migration_content (void *cls,
                            enum GNUNET_BLOCK_Type type,
                            uint32_t priority,
                            uint32_t anonymity,
+                           uint32_t replication,
                            struct GNUNET_TIME_Absolute expiration,
                            uint64_t uid)
 {
@@ -490,9 +493,11 @@ process_migration_content (void *cls,
                                           type,
                                           priority,
                                           anonymity,
+                                          replication,
                                           expiration,
                                           uid,
-                                          &process_migration_content, NULL))
+                                          &process_migration_content,
+                                          NULL))
       consider_gathering ();
     return;
   }
@@ -517,9 +522,11 @@ process_migration_content (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                "Preparing to push best content to peer %s\n",
                GNUNET_i2s (GSF_connected_peer_get_identity2_(pos->peer)));
-    if (GNUNET_YES == transmit_content (pos,
-                                       mb))
+    if ( (NULL == pos->env) &&
+         (GNUNET_YES == transmit_content (pos,
+                                          mb)) ) {
       break;                  /* 'mb' was freed! */
+    }
   }
   consider_gathering ();
 }