diff options
Diffstat (limited to 'src/transport/test_transport_api_manipulation_cfg.c')
-rw-r--r-- | src/transport/test_transport_api_manipulation_cfg.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/src/transport/test_transport_api_manipulation_cfg.c b/src/transport/test_transport_api_manipulation_cfg.c index b7321af85..c9bb5d08a 100644 --- a/src/transport/test_transport_api_manipulation_cfg.c +++ b/src/transport/test_transport_api_manipulation_cfg.c | |||
@@ -25,8 +25,8 @@ | |||
25 | * Peer 1 has inbound and outbound delay of 100ms | 25 | * Peer 1 has inbound and outbound delay of 100ms |
26 | * Peer 2 has no inbound and outbound delay | 26 | * Peer 2 has no inbound and outbound delay |
27 | * | 27 | * |
28 | * We send a request from P1 to P2 and expect delay of >= TEST_DELAY ms | 28 | * We send a request from P1 to P2 and expect delay of >= TEST_DELAY us |
29 | * Then we send response from P2 to P1 and expect delay of >= TEST_DELAY ms | 29 | * Then we send response from P2 to P1 and expect delay of >= TEST_DELAY us |
30 | */ | 30 | */ |
31 | #include "platform.h" | 31 | #include "platform.h" |
32 | #include "gnunet_transport_service.h" | 32 | #include "gnunet_transport_service.h" |
@@ -48,7 +48,10 @@ | |||
48 | 48 | ||
49 | #define TEST_RESPONSE_MESSAGE_TYPE 12346 | 49 | #define TEST_RESPONSE_MESSAGE_TYPE 12346 |
50 | 50 | ||
51 | #define TEST_DELAY 100 | 51 | /** |
52 | * Test delay, in microseconds. | ||
53 | */ | ||
54 | #define TEST_DELAY 100 * 1000LL | ||
52 | 55 | ||
53 | static char *test_source; | 56 | static char *test_source; |
54 | 57 | ||
@@ -304,16 +307,18 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
304 | case TEST_REQUEST_MESSAGE_TYPE: | 307 | case TEST_REQUEST_MESSAGE_TYPE: |
305 | duration = GNUNET_TIME_absolute_get_difference(start_request, | 308 | duration = GNUNET_TIME_absolute_get_difference(start_request, |
306 | GNUNET_TIME_absolute_get()); | 309 | GNUNET_TIME_absolute_get()); |
307 | if (duration.rel_value >= TEST_DELAY) | 310 | if (duration.rel_value_us >= TEST_DELAY) |
308 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 311 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
309 | "Request message was delayed for %llu ms\n", | 312 | "Request message was delayed for %s\n", |
310 | duration.rel_value); | 313 | GNUNET_STRINGS_relative_time_to_string (duration, |
314 | GNUNET_YES)); | ||
311 | else | 315 | else |
312 | { | 316 | { |
313 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 317 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
314 | "Request message was delayed for %llu ms, should be %u ms\n", | 318 | "Request message was delayed for unexpected duration %s\n", |
315 | duration.rel_value, TEST_DELAY); | 319 | GNUNET_STRINGS_relative_time_to_string (duration, |
316 | ok = 1; | 320 | GNUNET_YES)); |
321 | ok = 1; | ||
317 | } | 322 | } |
318 | 323 | ||
319 | /* Send response */ | 324 | /* Send response */ |
@@ -323,15 +328,18 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
323 | case TEST_RESPONSE_MESSAGE_TYPE: | 328 | case TEST_RESPONSE_MESSAGE_TYPE: |
324 | duration = GNUNET_TIME_absolute_get_difference(start_response, | 329 | duration = GNUNET_TIME_absolute_get_difference(start_response, |
325 | GNUNET_TIME_absolute_get()); | 330 | GNUNET_TIME_absolute_get()); |
326 | if (duration.rel_value >= TEST_DELAY) | 331 | if (duration.rel_value_us >= TEST_DELAY) |
327 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 332 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
328 | "Response message was delayed for %llu ms\n", duration); | 333 | "Response message was delayed for %s\n", |
334 | GNUNET_STRINGS_relative_time_to_string (duration, | ||
335 | GNUNET_YES)); | ||
329 | else | 336 | else |
330 | { | 337 | { |
331 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 338 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
332 | "Response message was delayed for %llu ms, should be %u ms\n", | 339 | "Response message was delayed for unexpected duration %s\n", |
333 | duration.rel_value, TEST_DELAY); | 340 | GNUNET_STRINGS_relative_time_to_string (duration, |
334 | ok = 1; | 341 | GNUNET_YES)); |
342 | ok = 1; | ||
335 | } | 343 | } |
336 | /* Done */ | 344 | /* Done */ |
337 | ok = 0; | 345 | ok = 0; |