aboutsummaryrefslogtreecommitdiff
path: root/src/fragmentation
diff options
context:
space:
mode:
Diffstat (limited to 'src/fragmentation')
-rw-r--r--src/fragmentation/test_fragmentation.c24
-rw-r--r--src/fragmentation/test_fragmentation_parallel.c18
2 files changed, 21 insertions, 21 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,
diff --git a/src/fragmentation/test_fragmentation_parallel.c b/src/fragmentation/test_fragmentation_parallel.c
index 5cde75c0b..d8e598484 100644
--- a/src/fragmentation/test_fragmentation_parallel.c
+++ b/src/fragmentation/test_fragmentation_parallel.c
@@ -90,7 +90,7 @@ proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr)
90 const char *buf; 90 const char *buf;
91 91
92#if DETAILS 92#if DETAILS
93 FPRINTF (stderr, "%s", "!"); /* message complete, good! */ 93 fprintf (stderr, "%s", "!"); /* message complete, good! */
94#endif 94#endif
95 buf = (const char *) hdr; 95 buf = (const char *) hdr;
96 for (i = sizeof (struct GNUNET_MessageHeader); i < ntohs (hdr->size); i++) 96 for (i = sizeof (struct GNUNET_MessageHeader); i < ntohs (hdr->size); i++)
@@ -98,7 +98,7 @@ proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr)
98 total++; 98 total++;
99#if ! DETAILS 99#if ! DETAILS
100 if (0 == (total % (NUM_MSGS / 100))) 100 if (0 == (total % (NUM_MSGS / 100)))
101 FPRINTF (stderr, "%s", "."); 101 fprintf (stderr, "%s", ".");
102#endif 102#endif
103 /* tolerate 10% loss, i.e. due to duplicate fragment IDs */ 103 /* tolerate 10% loss, i.e. due to duplicate fragment IDs */
104 if ((total >= NUM_MSGS - (NUM_MSGS / 10)) && (ret != 0)) 104 if ((total >= NUM_MSGS - (NUM_MSGS / 10)) && (ret != 0))
@@ -131,7 +131,7 @@ proc_acks (void *cls, uint32_t msg_id, const struct GNUNET_MessageHeader *hdr)
131 if (ret == GNUNET_OK) 131 if (ret == GNUNET_OK)
132 { 132 {
133#if DETAILS 133#if DETAILS
134 FPRINTF (stderr, "%s", "@"); /* good ACK */ 134 fprintf (stderr, "%s", "@"); /* good ACK */
135#endif 135#endif
136 GNUNET_FRAGMENT_context_destroy (frags[i], NULL, NULL); 136 GNUNET_FRAGMENT_context_destroy (frags[i], NULL, NULL);
137 frags[i] = NULL; 137 frags[i] = NULL;
@@ -141,14 +141,14 @@ proc_acks (void *cls, uint32_t msg_id, const struct GNUNET_MessageHeader *hdr)
141 if (ret == GNUNET_NO) 141 if (ret == GNUNET_NO)
142 { 142 {
143#if DETAILS 143#if DETAILS
144 FPRINTF (stderr, "%s", "@"); /* good ACK */ 144 fprintf (stderr, "%s", "@"); /* good ACK */
145#endif 145#endif
146 acks++; 146 acks++;
147 return; 147 return;
148 } 148 }
149 } 149 }
150#if DETAILS 150#if DETAILS
151 FPRINTF (stderr, "%s", "_"); /* BAD: ack that nobody feels responsible for... */ 151 fprintf (stderr, "%s", "_"); /* BAD: ack that nobody feels responsible for... */
152#endif 152#endif
153} 153}
154 154
@@ -170,21 +170,21 @@ proc_frac (void *cls, const struct GNUNET_MessageHeader *hdr)
170 } 170 }
171 if (NULL == defrag) 171 if (NULL == defrag)
172 { 172 {
173 FPRINTF (stderr, "%s", "E"); /* Error: frag after shutdown!? */ 173 fprintf (stderr, "%s", "E"); /* Error: frag after shutdown!? */
174 return; 174 return;
175 } 175 }
176 ret = GNUNET_DEFRAGMENT_process_fragment (defrag, hdr); 176 ret = GNUNET_DEFRAGMENT_process_fragment (defrag, hdr);
177 if (ret == GNUNET_NO) 177 if (ret == GNUNET_NO)
178 { 178 {
179#if DETAILS 179#if DETAILS
180 FPRINTF (stderr, "%s", "?"); /* duplicate fragment */ 180 fprintf (stderr, "%s", "?"); /* duplicate fragment */
181#endif 181#endif
182 dups++; 182 dups++;
183 } 183 }
184 else if (ret == GNUNET_OK) 184 else if (ret == GNUNET_OK)
185 { 185 {
186#if DETAILS 186#if DETAILS
187 FPRINTF (stderr, "%s", "."); /* good fragment */ 187 fprintf (stderr, "%s", "."); /* good fragment */
188#endif 188#endif
189 fragc++; 189 fragc++;
190 } 190 }
@@ -247,7 +247,7 @@ main (int argc, char *argv[])
247 100); 247 100);
248 GNUNET_PROGRAM_run (5, argv_prog, "test-fragmentation", "nohelp", options, 248 GNUNET_PROGRAM_run (5, argv_prog, "test-fragmentation", "nohelp", options,
249 &run, NULL); 249 &run, NULL);
250 FPRINTF (stderr, 250 fprintf (stderr,
251 "\nHad %u good fragments, %u duplicate fragments, %u acks and %u simulated drops of acks\n", 251 "\nHad %u good fragments, %u duplicate fragments, %u acks and %u simulated drops of acks\n",
252 fragc, dups, acks, ack_drops); 252 fragc, dups, acks, ack_drops);
253 return ret; 253 return ret;