aboutsummaryrefslogtreecommitdiff
path: root/src/core/test_core_quota_compliance.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-11-18 10:23:32 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-11-18 10:23:32 +0000
commit39217556ab01b9145827062baeb4f871aec4b44d (patch)
tree45e84d9185e7de7d5b61f5dda6ab7b1b6662e28e /src/core/test_core_quota_compliance.c
parent8d1e110fce531925bf66a70722198081370799cd (diff)
downloadgnunet-39217556ab01b9145827062baeb4f871aec4b44d.tar.gz
gnunet-39217556ab01b9145827062baeb4f871aec4b44d.zip
Renaming MSIZE to MESSAGESIZE since MSIZE seems to be in use on FreeBSD Systems
Diffstat (limited to 'src/core/test_core_quota_compliance.c')
-rw-r--r--src/core/test_core_quota_compliance.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index efdcefac5..9e0f33522 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -65,7 +65,7 @@
65#define FAST_TIMEOUT GNUNET_TIME_relative_divide (GNUNET_CONSTANTS_MAX_CORK_DELAY, 2) 65#define FAST_TIMEOUT GNUNET_TIME_relative_divide (GNUNET_CONSTANTS_MAX_CORK_DELAY, 2)
66 66
67#define MTYPE 12345 67#define MTYPE 12345
68#define MSIZE 1024 68#define MESSAGESIZE 1024
69#define MEASUREMENT_LENGTH GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) 69#define MEASUREMENT_LENGTH GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
70 70
71static unsigned long long total_bytes_sent; 71static unsigned long long total_bytes_sent;
@@ -319,13 +319,13 @@ transmit_ready (void *cls, size_t size, void *buf)
319 0, 319 0,
320 FAST_TIMEOUT, 320 FAST_TIMEOUT,
321 &p2.id, 321 &p2.id,
322 MSIZE, 322 MESSAGESIZE,
323 &transmit_ready, &p1)); 323 &transmit_ready, &p1));
324 return 0; 324 return 0;
325 } 325 }
326 GNUNET_assert (tr_n < TOTAL_MSGS); 326 GNUNET_assert (tr_n < TOTAL_MSGS);
327 ret = 0; 327 ret = 0;
328 GNUNET_assert (size >= MSIZE); 328 GNUNET_assert (size >= MESSAGESIZE);
329 GNUNET_assert (buf != NULL); 329 GNUNET_assert (buf != NULL);
330 cbuf = buf; 330 cbuf = buf;
331 do 331 do
@@ -334,21 +334,21 @@ transmit_ready (void *cls, size_t size, void *buf)
334 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 334 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
335 "Sending message %u of size %u at offset %u\n", 335 "Sending message %u of size %u at offset %u\n",
336 tr_n, 336 tr_n,
337 MSIZE, 337 MESSAGESIZE,
338 ret); 338 ret);
339#endif 339#endif
340 hdr.header.size = htons (MSIZE); 340 hdr.header.size = htons (MESSAGESIZE);
341 hdr.header.type = htons (MTYPE); 341 hdr.header.type = htons (MTYPE);
342 hdr.num = htonl (tr_n); 342 hdr.num = htonl (tr_n);
343 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage)); 343 memcpy (&cbuf[ret], &hdr, sizeof (struct TestMessage));
344 ret += sizeof (struct TestMessage); 344 ret += sizeof (struct TestMessage);
345 memset (&cbuf[ret], tr_n, MSIZE - sizeof (struct TestMessage)); 345 memset (&cbuf[ret], tr_n, MESSAGESIZE - sizeof (struct TestMessage));
346 ret += MSIZE - sizeof (struct TestMessage); 346 ret += MESSAGESIZE - sizeof (struct TestMessage);
347 tr_n++; 347 tr_n++;
348 if (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16)) 348 if (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 16))
349 break; /* sometimes pack buffer full, sometimes not */ 349 break; /* sometimes pack buffer full, sometimes not */
350 } 350 }
351 while (size - ret >= MSIZE); 351 while (size - ret >= MESSAGESIZE);
352 GNUNET_SCHEDULER_cancel (err_task); 352 GNUNET_SCHEDULER_cancel (err_task);
353 err_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 353 err_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
354 &terminate_task_error, 354 &terminate_task_error,
@@ -391,7 +391,7 @@ connect_notify (void *cls,
391 0, 391 0,
392 TIMEOUT, 392 TIMEOUT,
393 &p2.id, 393 &p2.id,
394 MSIZE, 394 MESSAGESIZE,
395 &transmit_ready, &p1)); 395 &transmit_ready, &p1));
396 } 396 }
397} 397}
@@ -455,11 +455,11 @@ process_mtype (void *cls,
455 hdr = (const struct TestMessage*) message; 455 hdr = (const struct TestMessage*) message;
456 if (MTYPE != ntohs (message->type)) 456 if (MTYPE != ntohs (message->type))
457 return GNUNET_SYSERR; 457 return GNUNET_SYSERR;
458 if (ntohs (message->size) != MSIZE) 458 if (ntohs (message->size) != MESSAGESIZE)
459 { 459 {
460 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 460 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
461 "Expected message %u of size %u, got %u bytes of message %u\n", 461 "Expected message %u of size %u, got %u bytes of message %u\n",
462 n, MSIZE, 462 n, MESSAGESIZE,
463 ntohs (message->size), 463 ntohs (message->size),
464 ntohl (hdr->num)); 464 ntohl (hdr->num));
465 GNUNET_SCHEDULER_cancel (err_task); 465 GNUNET_SCHEDULER_cancel (err_task);
@@ -470,7 +470,7 @@ process_mtype (void *cls,
470 { 470 {
471 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 471 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
472 "Expected message %u of size %u, got %u bytes of message %u\n", 472 "Expected message %u of size %u, got %u bytes of message %u\n",
473 n, MSIZE, 473 n, MESSAGESIZE,
474 ntohs (message->size), 474 ntohs (message->size),
475 ntohl (hdr->num)); 475 ntohl (hdr->num));
476 GNUNET_SCHEDULER_cancel (err_task); 476 GNUNET_SCHEDULER_cancel (err_task);
@@ -499,7 +499,7 @@ process_mtype (void *cls,
499 0, 499 0,
500 FAST_TIMEOUT, 500 FAST_TIMEOUT,
501 &p2.id, 501 &p2.id,
502 MSIZE, 502 MESSAGESIZE,
503 &transmit_ready, &p1)); 503 &transmit_ready, &p1));
504 } 504 }
505 return GNUNET_OK; 505 return GNUNET_OK;