more assertions
authorSree Harsha Totakura <totakura@in.tum.de>
Tue, 28 Jul 2015 15:29:19 +0000 (15:29 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Tue, 28 Jul 2015 15:29:19 +0000 (15:29 +0000)
src/rps/gnunet-service-rps.c
src/rps/rps.h
src/rps/test_rps.c

index f0393bdf07b37faffb4490ddc9d240685a7667e5..71903709a02b70325b1e0ff95263c1a44508be4a 100644 (file)
@@ -410,7 +410,7 @@ static struct GNUNET_CONTAINER_MultiPeerMap *mal_peer_set = NULL;
 /**
  * Number of other malicious peers
  */
-static uint32_t num_mal_peers = 0;
+static uint32_t num_mal_peers;
 
 
 /**
@@ -1288,6 +1288,7 @@ void client_respond (void *cls,
   uint32_t size_needed;
   struct ClientContext *cli_ctx;
 
+  GNUNET_assert (NULL != reply_cls);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "sampler returned %" PRIu32 " peers:\n",
        num_peers);
@@ -1415,6 +1416,7 @@ handle_client_seed (void *cls,
     GNUNET_break_op (0);
     GNUNET_SERVER_receive_done (client,
                                 GNUNET_SYSERR);
+    return;
   }
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1989,6 +1991,7 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round maliciously type %" PRIu32 ".\n",
       mal_type);
 
+  GNUNET_assert (mal_type <= 3);
   /* Do malicious actions */
   if (1 == mal_type)
   { /* Try to maximise representation */
index e1583d06c97f8a4c16cb996737ece434c590f047..9a16e7593fe9381d86986ac4afb6e9010b737803 100644 (file)
@@ -154,7 +154,8 @@ struct GNUNET_RPS_CS_ActMaliciousMessage
    */
   uint32_t num_peers GNUNET_PACKED;
 
-  /* Followed by num_peers * GNUNET_PeerIdentity */
+  /* Followed by num_peers * GNUNET_PeerIdentity when the type of malicious
+     behaviour is 1 */
 };
 #endif /* ENABLE_MALICIOUS */
 
index a430f4a83cd045dce35a8ad33766beee12c01ff1..108c1bd34205ce34af550e700f212c8441537816 100644 (file)
@@ -1147,18 +1147,14 @@ run (void *cls,
     rps_peers[i].index = i;
     rps_peers[i].op =
       GNUNET_TESTBED_service_connect (&rps_peers[i],
-                                                                         peers[i],
-                                                                         "rps",
-                                                                         &rps_connect_complete_cb,
-                                                                         &rps_peers[i],
-                                                                         &rps_connect_adapter,
-                                                                         &rps_disconnect_adapter,
-                                                                         &rps_peers[i]);
+                                      peers[i],
+                                      "rps",
+                                      &rps_connect_complete_cb,
+                                      &rps_peers[i],
+                                      &rps_connect_adapter,
+                                      &rps_disconnect_adapter,
+                                      &rps_peers[i]);
   }
-
-  if (NULL != churn_task)
-    GNUNET_SCHEDULER_cancel (churn_task);
-
   GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_task, NULL);
 }