Merge branch 'master' of ssh://gnunet.org/gnunet
[oweals/gnunet.git] / src / rps / test_rps.c
index e0fbdbb887ae214d6af6c53a2e16548d449dd264..1ce174454dc8e909675442775057ad12e81e3793 100644 (file)
@@ -399,12 +399,19 @@ tofile_ (const char *file_name, const char *line)
                 "Unable to write to file! (Size: %lu, size2: %lu)\n",
                 size,
                 size2);
+    if (GNUNET_YES != GNUNET_DISK_file_close (f))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Unable to close file\n");
+    }
     return;
   }
 
   if (GNUNET_YES != GNUNET_DISK_file_close (f))
+  {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Unable to close file\n");
+  }
 }
 
 /**
@@ -586,10 +593,11 @@ info_cb (void *cb_cls,
   rps_peer_ids[entry->index] = *(pinfo->result.id);
   rps_peers[entry->index].peer_id = &rps_peer_ids[entry->index];
 
-  GNUNET_CONTAINER_multipeermap_put (peer_map,
-      &rps_peer_ids[entry->index],
-      &rps_peers[entry->index],
-      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+  GNUNET_assert (GNUNET_OK ==
+      GNUNET_CONTAINER_multipeermap_put (peer_map,
+        &rps_peer_ids[entry->index],
+        &rps_peers[entry->index],
+        GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   tofile ("/tmp/rps/peer_ids",
            "%u\t%s\n",
            entry->index,
@@ -1235,6 +1243,7 @@ profiler_reply_handle (void *cls,
              "%s\n",
              GNUNET_i2s_full (&recv_peers[i]));
     rcv_rps_peer = GNUNET_CONTAINER_multipeermap_get (peer_map, &recv_peers[i]);
+    GNUNET_assert (NULL != rcv_rps_peer);
     tofile (file_name_dh,
              "%" PRIu32 "\n",
              (uint32_t) rcv_rps_peer->index);
@@ -1292,6 +1301,7 @@ file_name_cb (void *cls, const char *filename)
     {
       RPS_sampler_elem_next (s_elem, &rps_peer_ids[i]);
     }
+    RPS_sampler_elem_destroy (s_elem);
   }
   return GNUNET_OK;
 }