- moved timeout handling responsibility from for nat tests from caller to the library
[oweals/gnunet.git] / src / cadet / test_cadet.c
index 244fcd1e056af9af26e1a9ffd268f31e6629b41e..fb2a99f5bac899225241099150acdd7c90764cd1 100644 (file)
@@ -330,8 +330,9 @@ data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     channel = ch;
   }
   th = GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
-                                          GNUNET_TIME_UNIT_FOREVER_REL,
-                                          size_payload, &tmt_rdy, (void *) 1L);
+                                           GNUNET_TIME_UNIT_FOREVER_REL,
+                                           size_payload + data_sent,
+                                           &tmt_rdy, (void *) 1L);
   if (NULL == th)
   {
     unsigned long i = (unsigned long) cls;
@@ -489,8 +490,9 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
     if (SPEED != test || (ok_goal - 2) == ok)
     {
       GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
-                                         GNUNET_TIME_UNIT_FOREVER_REL,
-                                         size_payload, &tmt_rdy, (void *) 1L);
+                                          GNUNET_TIME_UNIT_FOREVER_REL,
+                                          size_payload + data_sent,
+                                          &tmt_rdy, (void *) 1L);
       return GNUNET_OK;
     }
     else
@@ -506,8 +508,9 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
       data_ack++;
       GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", data_ack);
       GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
-                                         GNUNET_TIME_UNIT_FOREVER_REL,
-                                         size_payload, &tmt_rdy, (void *) 1L);
+                                          GNUNET_TIME_UNIT_FOREVER_REL,
+                                          size_payload + data_sent,
+                                          &tmt_rdy, (void *) 1L);
       if (data_ack < TOTAL_PACKETS && SPEED != test)
         return GNUNET_OK;
       if (ok == 2 && SPEED == test)
@@ -591,7 +594,7 @@ stats_iterator (void *cls, const struct GNUNET_TESTBED_Peer *peer,
   if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i)
     ka_sent = value;
 
-  if (0 == strncmp(s_recv, name, strlen (s_recv)) && 4 == i)
+  if (0 == strncmp(s_recv, name, strlen (s_recv)) && peers_requested - 1 == i)
     ka_received = value;
 
   return GNUNET_OK;
@@ -880,21 +883,21 @@ main (int argc, char *argv[])
   }
 
   /* Find out requested test */
-  if (strstr (argv[0], "_cadet_forward") != NULL)
+  if (strstr (argv[0], "_forward") != NULL)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FORWARD\n");
     test = FORWARD;
     test_name = "unicast";
     ok_goal = 4;
   }
-  else if (strstr (argv[0], "_cadet_signal") != NULL)
+  else if (strstr (argv[0], "_signal") != NULL)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SIGNAL\n");
     test = P2P_SIGNAL;
     test_name = "signal";
     ok_goal = 4;
   }
-  else if (strstr (argv[0], "_cadet_speed_ack") != NULL)
+  else if (strstr (argv[0], "_speed_ack") != NULL)
   {
     /* Test is supposed to generate the following callbacks:
      * 1 incoming channel (@dest)
@@ -907,7 +910,7 @@ main (int argc, char *argv[])
     test = SPEED_ACK;
     test_name = "speed ack";
   }
-  else if (strstr (argv[0], "_cadet_speed") != NULL)
+  else if (strstr (argv[0], "_speed") != NULL)
   {
     /* Test is supposed to generate the following callbacks:
      * 1 incoming channel (@dest)