aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api_unreliability.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-11-05 13:52:46 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-11-05 13:52:46 +0000
commit62f7736a0c70bfffab52212615318b9a9db5f9fc (patch)
tree150dff0051e071594b62c62bd9a8afcf17720c30 /src/transport/test_transport_api_unreliability.c
parent7eaa52f1da8ab5c9890013fd2127488754570b99 (diff)
downloadgnunet-62f7736a0c70bfffab52212615318b9a9db5f9fc.tar.gz
gnunet-62f7736a0c70bfffab52212615318b9a9db5f9fc.zip
bug hunting
Diffstat (limited to 'src/transport/test_transport_api_unreliability.c')
-rw-r--r--src/transport/test_transport_api_unreliability.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c
index 56e609e92..4a818c8bf 100644
--- a/src/transport/test_transport_api_unreliability.c
+++ b/src/transport/test_transport_api_unreliability.c
@@ -230,8 +230,9 @@ get_size (unsigned int iter)
230 * Sets a bit active in the bitmap. 230 * Sets a bit active in the bitmap.
231 * 231 *
232 * @param bitIdx which bit to set 232 * @param bitIdx which bit to set
233 * @return GNUNET_SYSERR on error, GNUNET_OK on success
233 */ 234 */
234static void 235static int
235set_bit (unsigned int bitIdx) 236set_bit (unsigned int bitIdx)
236{ 237{
237 size_t arraySlot; 238 size_t arraySlot;
@@ -239,13 +240,14 @@ set_bit (unsigned int bitIdx)
239 240
240 if (bitIdx >= sizeof (bitmap) * 8) 241 if (bitIdx >= sizeof (bitmap) * 8)
241 { 242 {
242 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "tried to set bit %d of %d(!?!?)\n", 243 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "tried to set bit %d of %d(!?!?)\n",
243 bitIdx, sizeof (bitmap) * 8); 244 bitIdx, sizeof (bitmap) * 8);
244 return; 245 return GNUNET_SYSERR;
245 } 246 }
246 arraySlot = bitIdx / 8; 247 arraySlot = bitIdx / 8;
247 targetBit = (1L << (bitIdx % 8)); 248 targetBit = (1L << (bitIdx % 8));
248 bitmap[arraySlot] |= targetBit; 249 bitmap[arraySlot] |= targetBit;
250 return GNUNET_OK;
249} 251}
250 252
251/** 253/**
@@ -319,7 +321,12 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
319 } 321 }
320#endif 322#endif
321 n++; 323 n++;
322 set_bit (ntohl (hdr->num)); 324 if (GNUNET_SYSERR == set_bit (ntohl (hdr->num)))
325 {
326 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
327 _("Message id %u is bigger than maxmimum number of messages sent\n"),
328 ntohl (hdr->num), TOTAL_MSGS);
329 }
323 test_sending = GNUNET_YES; 330 test_sending = GNUNET_YES;
324 if (0 == (n % (TOTAL_MSGS / 100))) 331 if (0 == (n % (TOTAL_MSGS / 100)))
325 { 332 {
@@ -379,7 +386,6 @@ notify_ready (void *cls, size_t size, void *buf)
379 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message %u of size %u\n", n, 386 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message %u of size %u\n", n,
380 s); 387 s);
381 } 388 }
382
383#endif 389#endif
384 n++; 390 n++;
385 s = get_size (n); 391 s = get_size (n);