aboutsummaryrefslogtreecommitdiff
path: root/src/fragmentation/test_fragmentation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fragmentation/test_fragmentation.c')
-rw-r--r--src/fragmentation/test_fragmentation.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/fragmentation/test_fragmentation.c b/src/fragmentation/test_fragmentation.c
index 0bf3b2ab1..a49f6d71a 100644
--- a/src/fragmentation/test_fragmentation.c
+++ b/src/fragmentation/test_fragmentation.c
@@ -98,7 +98,7 @@ proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr)
98 const char *buf; 98 const char *buf;
99 99
100#if DETAILS 100#if DETAILS
101 FPRINTF (stderr, "%s", "M! "); /* message complete, good! */ 101 fprintf (stderr, "%s", "M! "); /* message complete, good! */
102#endif 102#endif
103 buf = (const char *) hdr; 103 buf = (const char *) hdr;
104 for (i = sizeof (struct GNUNET_MessageHeader); i < ntohs (hdr->size); i++) 104 for (i = sizeof (struct GNUNET_MessageHeader); i < ntohs (hdr->size); i++)
@@ -106,7 +106,7 @@ proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr)
106 total++; 106 total++;
107#if ! DETAILS 107#if ! DETAILS
108 if (0 == (total % (NUM_MSGS / 100))) 108 if (0 == (total % (NUM_MSGS / 100)))
109 FPRINTF (stderr, "%s", "."); 109 fprintf (stderr, "%s", ".");
110#endif 110#endif
111 /* tolerate 10% loss, i.e. due to duplicate fragment IDs */ 111 /* tolerate 10% loss, i.e. due to duplicate fragment IDs */
112 if ((total >= NUM_MSGS - (NUM_MSGS / 10)) && (ret != 0)) 112 if ((total >= NUM_MSGS - (NUM_MSGS / 10)) && (ret != 0))
@@ -131,27 +131,27 @@ proc_frac (void *cls, const struct GNUNET_MessageHeader *hdr)
131 { 131 {
132 frag_drops++; 132 frag_drops++;
133#if DETAILS 133#if DETAILS
134 FPRINTF (stderr, "%s", "DF "); /* dropped Frag */ 134 fprintf (stderr, "%s", "DF "); /* dropped Frag */
135#endif 135#endif
136 return; /* random drop */ 136 return; /* random drop */
137 } 137 }
138 if (NULL == defrag) 138 if (NULL == defrag)
139 { 139 {
140 FPRINTF (stderr, "%s", "?E "); /* Error: frag after shutdown!? */ 140 fprintf (stderr, "%s", "?E "); /* Error: frag after shutdown!? */
141 return; 141 return;
142 } 142 }
143 ret = GNUNET_DEFRAGMENT_process_fragment (defrag, hdr); 143 ret = GNUNET_DEFRAGMENT_process_fragment (defrag, hdr);
144 if (ret == GNUNET_NO) 144 if (ret == GNUNET_NO)
145 { 145 {
146#if DETAILS 146#if DETAILS
147 FPRINTF (stderr, "%s", "FF "); /* duplicate fragment */ 147 fprintf (stderr, "%s", "FF "); /* duplicate fragment */
148#endif 148#endif
149 dups++; 149 dups++;
150 } 150 }
151 else if (ret == GNUNET_OK) 151 else if (ret == GNUNET_OK)
152 { 152 {
153#if DETAILS 153#if DETAILS
154 FPRINTF (stderr, "%s", "F! "); /* good fragment */ 154 fprintf (stderr, "%s", "F! "); /* good fragment */
155#endif 155#endif
156 fragc++; 156 fragc++;
157 } 157 }
@@ -181,7 +181,7 @@ next_transmission ()
181 if (i == NUM_MSGS) 181 if (i == NUM_MSGS)
182 return; 182 return;
183#if DETAILS 183#if DETAILS
184 FPRINTF (stderr, "%s", "T! "); /* sending message */ 184 fprintf (stderr, "%s", "T! "); /* sending message */
185#endif 185#endif
186 msg = (struct GNUNET_MessageHeader *) buf; 186 msg = (struct GNUNET_MessageHeader *) buf;
187 msg->type = htons ((uint16_t) i); 187 msg->type = htons ((uint16_t) i);
@@ -212,7 +212,7 @@ proc_acks (void *cls,
212 { 212 {
213 ack_drops++; 213 ack_drops++;
214#if DETAILS 214#if DETAILS
215 FPRINTF (stderr, "%s", "DA "); /* dropped ACK */ 215 fprintf (stderr, "%s", "DA "); /* dropped ACK */
216#endif 216#endif
217 return; /* random drop */ 217 return; /* random drop */
218 } 218 }
@@ -224,7 +224,7 @@ proc_acks (void *cls,
224 if (ret == GNUNET_OK) 224 if (ret == GNUNET_OK)
225 { 225 {
226#if DETAILS 226#if DETAILS
227 FPRINTF (stderr, "%s", "GA "); /* good ACK */ 227 fprintf (stderr, "%s", "GA "); /* good ACK */
228#endif 228#endif
229 next_transmission (); 229 next_transmission ();
230 acks++; 230 acks++;
@@ -233,14 +233,14 @@ proc_acks (void *cls,
233 if (ret == GNUNET_NO) 233 if (ret == GNUNET_NO)
234 { 234 {
235#if DETAILS 235#if DETAILS
236 FPRINTF (stderr, "%s", "AA "); /* duplciate ACK */ 236 fprintf (stderr, "%s", "AA "); /* duplciate ACK */
237#endif 237#endif
238 acks++; 238 acks++;
239 return; 239 return;
240 } 240 }
241 } 241 }
242#if DETAILS 242#if DETAILS
243 FPRINTF (stderr, "%s", "?A "); /* BAD: ack that nobody feels responsible for... */ 243 fprintf (stderr, "%s", "?A "); /* BAD: ack that nobody feels responsible for... */
244#endif 244#endif
245} 245}
246 246
@@ -293,7 +293,7 @@ main (int argc, char *argv[])
293 "test-fragmentation", "nohelp", 293 "test-fragmentation", "nohelp",
294 options, 294 options,
295 &run, NULL); 295 &run, NULL);
296 FPRINTF (stderr, 296 fprintf (stderr,
297 "\nHad %u good fragments, %u duplicate fragments, %u acks and %u simulated drops of acks\n", 297 "\nHad %u good fragments, %u duplicate fragments, %u acks and %u simulated drops of acks\n",
298 fragc, 298 fragc,
299 dups, 299 dups,