diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-05-23 00:37:46 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-05-23 00:37:46 +0000 |
commit | fbab5d34eb111e3d47e18d4b1f17e3b69c640d33 (patch) | |
tree | a61c749f51db0affeb566f4ebdf97f68b2e2e593 /src | |
parent | f6998548f05a758d78c1790643fc9cafda19817d (diff) | |
download | gnunet-fbab5d34eb111e3d47e18d4b1f17e3b69c640d33.tar.gz gnunet-fbab5d34eb111e3d47e18d4b1f17e3b69c640d33.zip |
- use increasing size data messages
Diffstat (limited to 'src')
-rw-r--r-- | src/cadet/test_cadet.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index ac2661a86..ba636abc3 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c | |||
@@ -122,7 +122,12 @@ static int data_received; | |||
122 | static int data_ack; | 122 | static int data_ack; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Total number of currently running peers. | 125 | * Total number of peers asked to run. |
126 | */ | ||
127 | static unsigned long long peers_requested; | ||
128 | |||
129 | /** | ||
130 | * Number of currently running peers (should be same as @c peers_requested). | ||
126 | */ | 131 | */ |
127 | static unsigned long long peers_running; | 132 | static unsigned long long peers_running; |
128 | 133 | ||
@@ -354,7 +359,7 @@ data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
354 | /** | 359 | /** |
355 | * Transmit ready callback | 360 | * Transmit ready callback |
356 | * | 361 | * |
357 | * @param cls Closure (message type). | 362 | * @param cls Closure (unused). |
358 | * @param size Size of the buffer we have. | 363 | * @param size Size of the buffer we have. |
359 | * @param buf Buffer to copy data to. | 364 | * @param buf Buffer to copy data to. |
360 | */ | 365 | */ |
@@ -362,11 +367,13 @@ size_t | |||
362 | tmt_rdy (void *cls, size_t size, void *buf) | 367 | tmt_rdy (void *cls, size_t size, void *buf) |
363 | { | 368 | { |
364 | struct GNUNET_MessageHeader *msg = buf; | 369 | struct GNUNET_MessageHeader *msg = buf; |
370 | size_t msg_size; | ||
365 | uint32_t *data; | 371 | uint32_t *data; |
366 | 372 | ||
367 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 373 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
368 | "tmt_rdy called, filling buffer\n"); | 374 | "tmt_rdy called, filling buffer\n"); |
369 | if (size < size_payload || NULL == buf) | 375 | msg_size = size_payload + data_sent; |
376 | if (size < msg_size || NULL == buf) | ||
370 | { | 377 | { |
371 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 378 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
372 | "size %u, buf %p, data_sent %u, data_received %u\n", | 379 | "size %u, buf %p, data_sent %u, data_received %u\n", |
@@ -382,23 +389,22 @@ tmt_rdy (void *cls, size_t size, void *buf) | |||
382 | *data = htonl (data_sent); | 389 | *data = htonl (data_sent); |
383 | if (GNUNET_NO == initialized) | 390 | if (GNUNET_NO == initialized) |
384 | { | 391 | { |
385 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 392 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending initializer\n"); |
386 | "sending initializer\n"); | ||
387 | } | 393 | } |
388 | else if (SPEED == test) | 394 | else if (SPEED == test) |
389 | { | 395 | { |
390 | data_sent++; | 396 | data_sent++; |
391 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 397 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Sent message %d size %u\n", |
392 | " Sent packet %d\n", data_sent); | 398 | data_sent, msg_size); |
393 | if (data_sent < TOTAL_PACKETS) | 399 | if (data_sent < TOTAL_PACKETS) |
394 | { | 400 | { |
395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 401 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Scheduling message %d\n", |
396 | " Scheduling packet %d\n", data_sent + 1); | 402 | data_sent + 1); |
397 | GNUNET_SCHEDULER_add_now (&data_task, NULL); | 403 | GNUNET_SCHEDULER_add_now (&data_task, NULL); |
398 | } | 404 | } |
399 | } | 405 | } |
400 | 406 | ||
401 | return size_payload; | 407 | return msg_size; |
402 | } | 408 | } |
403 | 409 | ||
404 | 410 | ||