From 502af2167f7c218366666ca4944bd7cc54b5b19a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 15 Aug 2011 21:46:35 +0000 Subject: indentation --- src/fragmentation/test_fragmentation.c | 170 +++++++++++++++------------------ 1 file changed, 79 insertions(+), 91 deletions(-) (limited to 'src/fragmentation/test_fragmentation.c') diff --git a/src/fragmentation/test_fragmentation.c b/src/fragmentation/test_fragmentation.c index 25f1c2053..b534a134e 100644 --- a/src/fragmentation/test_fragmentation.c +++ b/src/fragmentation/test_fragmentation.c @@ -44,7 +44,7 @@ */ #define DROPRATE 10 -static int ret = 1; +static int ret = 1; static unsigned int dups; @@ -63,18 +63,17 @@ static struct GNUNET_BANDWIDTH_Tracker trackers[NUM_MSGS]; static struct GNUNET_FRAGMENT_Context *frags[NUM_MSGS]; static void -proc_msgs (void *cls, - const struct GNUNET_MessageHeader *hdr) +proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr) { static unsigned int total; unsigned int i; const char *buf; #if DETAILS - fprintf (stderr, "!"); /* message complete, good! */ + fprintf (stderr, "!"); /* message complete, good! */ #endif - buf = (const char*) hdr; - for (i=sizeof (struct GNUNET_MessageHeader);isize);i++) + buf = (const char *) hdr; + for (i = sizeof (struct GNUNET_MessageHeader); i < ntohs (hdr->size); i++) GNUNET_assert (buf[i] == (char) i); total++; #if ! DETAILS @@ -83,18 +82,18 @@ proc_msgs (void *cls, #endif /* tolerate 10% loss, i.e. due to duplicate fragment IDs */ if (total >= NUM_MSGS - (NUM_MSGS / 10)) + { + ret = 0; + GNUNET_DEFRAGMENT_context_destroy (defrag); + defrag = NULL; + for (i = 0; i < NUM_MSGS; i++) { - ret = 0; - GNUNET_DEFRAGMENT_context_destroy (defrag); - defrag = NULL; - for (i=0;itype = htons ((uint16_t) i); - msg->size = htons (sizeof (struct GNUNET_MessageHeader) + (17 * i) % (32 * 1024)); - frags[i] = GNUNET_FRAGMENT_context_create (NULL /* no stats */, - MTU, - &trackers[i], - GNUNET_TIME_UNIT_SECONDS, - msg, - &proc_frac, - &frags[i]); - } + msg = (struct GNUNET_MessageHeader *) buf; + for (i = 0; i < NUM_MSGS; i++) + { + msg->type = htons ((uint16_t) i); + msg->size = + htons (sizeof (struct GNUNET_MessageHeader) + (17 * i) % (32 * 1024)); + frags[i] = GNUNET_FRAGMENT_context_create (NULL /* no stats */ , + MTU, + &trackers[i], + GNUNET_TIME_UNIT_SECONDS, + msg, &proc_frac, &frags[i]); + } } @@ -247,16 +237,14 @@ main (int argc, char *argv[]) "WARNING", #endif NULL); - for (i=0;i