- fprintf (stderr, "@");
- for (i=0;i<NUM_MSGS;i++)
- {
- if (frags[i] == NULL)
- return;
- ret = GNUNET_FRAGMENT_process_ack (frags[i],
- hdr);
- if (ret == GNUNET_OK)
- {
- GNUNET_FRAGMENT_context_destroy (frags[i]);
- frags[i] = NULL;
- return;
- }
- if (ret == GNUNET_NO)
- return;
- }
- fprintf (stderr, "Got ACK that nobody feels responsible for...\n");
+ GNUNET_FRAGMENT_context_transmission_done (*fc);
+ if (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, DROPRATE))
+ {
+ frag_drops++;
+#if DETAILS
+ FPRINTF (stderr, "%s", "DF "); /* dropped Frag */
+#endif
+ return; /* random drop */
+ }
+ if (NULL == defrag)
+ {
+ FPRINTF (stderr, "%s", "?E "); /* Error: frag after shutdown!? */
+ return;
+ }
+ ret = GNUNET_DEFRAGMENT_process_fragment (defrag, hdr);
+ if (ret == GNUNET_NO)
+ {
+#if DETAILS
+ FPRINTF (stderr, "%s", "FF "); /* duplicate fragment */
+#endif
+ dups++;
+ }
+ else if (ret == GNUNET_OK)
+ {
+#if DETAILS
+ FPRINTF (stderr, "%s", "F! "); /* good fragment */
+#endif
+ fragc++;
+ }
+}
+
+
+static void
+next_transmission ()
+{
+ static unsigned int i;
+ struct GNUNET_MessageHeader *msg;
+ static char buf[MTU + 32 * 1024];
+ unsigned int j;
+
+ if (0 == i)
+ {
+ for (j = 0; j < sizeof (buf); j++)
+ buf[j] = (char) j;
+ }
+ else
+ {
+ GNUNET_FRAGMENT_context_destroy (frag,
+ &msg_delay,
+ &ack_delay);
+ frag = NULL;
+ }
+ if (i == NUM_MSGS)
+ return;
+#if DETAILS
+ FPRINTF (stderr, "%s", "T! "); /* sending message */
+#endif
+ msg = (struct GNUNET_MessageHeader *) buf;
+ msg->type = htons ((uint16_t) i);
+ msg->size =
+ htons (sizeof (struct GNUNET_MessageHeader) + (17 * i) % (32 * 1024));
+ frag = GNUNET_FRAGMENT_context_create (NULL /* no stats */ ,
+ MTU, &trackers[i],
+ msg_delay,
+ ack_delay,
+ msg,
+ &proc_frac, &frag);
+ i++;