-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
-
-static void
-notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_MessageHeader *message)
-{
- struct PeerContext *p = cls;
- struct PeerContext *t = NULL;
-
- if (0 == memcmp (peer, &p1->id, sizeof (struct GNUNET_PeerIdentity)))
- t = p1;
- if (0 == memcmp (peer, &p2->id, sizeof (struct GNUNET_PeerIdentity)))
- t = p2;
- GNUNET_assert (t != NULL);
-
- char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Peer %u (`%4s') received message of type %d and size %u size from peer %u (`%4s')!\n",
- p->no, ps, ntohs (message->type), ntohs (message->size), t->no,
- GNUNET_i2s (&t->id));
- GNUNET_free (ps);
-
- if ((TEST_MESSAGE_TYPE == ntohs (message->type)) &&
- (TEST_MESSAGE_SIZE == ntohs (message->size)))
- {
- ok = 0;
-
- }
- else
- {
- GNUNET_break (0);
- ok = 1;
- end ();
- return;
- }
-
- if (messages_recv <= 1)
- {
- /* Received non-delayed message */
- dur_normal = GNUNET_TIME_absolute_get_duration(start_normal);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received non-delayed message %u after %s\n",
- messages_recv,
- GNUNET_STRINGS_relative_time_to_string (dur_normal,
- GNUNET_YES));
-
- struct GNUNET_ATS_Properties prop;
- struct GNUNET_TIME_Relative delay;
-
- delay.rel_value_us = 1000 * 1000LL;
- memset (&prop, 0, sizeof (prop));
- prop.distance = 10;
- GNUNET_TRANSPORT_set_traffic_metric (p1->th,
- &p2->id,
- &prop,
- delay,
- GNUNET_TIME_UNIT_ZERO);
- send_task = GNUNET_SCHEDULER_add_now (&sendtask, NULL);
- }
- if (2 == messages_recv)
- {
- /* Received manipulated message */
- dur_delayed = GNUNET_TIME_absolute_get_duration(start_delayed);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received delayed message %u after %s\n",
- messages_recv,
- GNUNET_STRINGS_relative_time_to_string (dur_delayed,
- GNUNET_YES));
- if (dur_delayed.rel_value_us < 1000 * 1000LL)
- {
- GNUNET_break (0);
- ok += 1;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Delayed message was not delayed correctly: took only %s\n",
- GNUNET_STRINGS_relative_time_to_string (dur_delayed,
- GNUNET_YES));
- }
- /* shutdown */
- end ();
- }
-
- messages_recv ++;
-}
-
-
-static size_t
-notify_ready (void *cls, size_t size, void *buf)