test_exponential_backoff.c | test_exponential_backoff.c | |||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
* @file arm/test_exponential_backoff.c | * @file arm/test_exponential_backoff.c | |||
* @brief testcase for gnunet-service-arm.c | * @brief testcase for gnunet-service-arm.c | |||
*/ | */ | |||
#include "platform.h" | #include "platform.h" | |||
#include "gnunet_arm_service.h" | #include "gnunet_arm_service.h" | |||
#include "gnunet_client_lib.h" | #include "gnunet_client_lib.h" | |||
#include "gnunet_configuration_lib.h" | #include "gnunet_configuration_lib.h" | |||
#include "gnunet_program_lib.h" | #include "gnunet_program_lib.h" | |||
#include "gnunet_protocols.h" | #include "gnunet_protocols.h" | |||
#define VERBOSE GNUNET_EXTRA_LOGGING | #define VERBOSE GNUNET_NO | |||
#define START_ARM GNUNET_YES | #define START_ARM GNUNET_YES | |||
#define LOG_BACKOFF GNUNET_NO | #define LOG_BACKOFF GNUNET_NO | |||
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10 ) | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10 ) | |||
#define SERVICE_TEST_TIMEOUT GNUNET_TIME_UNIT_FOREVER_REL | #define SERVICE_TEST_TIMEOUT GNUNET_TIME_UNIT_FOREVER_REL | |||
#define FIVE_MILLISECONDS GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_M ILLISECONDS, 5) | #define FIVE_MILLISECONDS GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_M ILLISECONDS, 5) | |||
skipping to change at line 297 | skipping to change at line 297 | |||
const struct GNUNET_SCHEDULER_TaskContext | const struct GNUNET_SCHEDULER_TaskContext | |||
*tc) | *tc) | |||
{ | { | |||
static char a; | static char a; | |||
trialCount++; | trialCount++; | |||
#if LOG_BACKOFF | #if LOG_BACKOFF | |||
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | |||
{ | { | |||
fprintf (killLogFilePtr, "%d.Reason is shutdown!\n", trialCount); | FPRINTF (killLogFilePtr, "%d.Reason is shutdown!\n", trialCount); | |||
} | } | |||
else if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) | else if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) | |||
{ | { | |||
fprintf (killLogFilePtr, "%d.Reason is timeout!\n", trialCount); | FPRINTF (killLogFilePtr, "%d.Reason is timeout!\n", trialCount); | |||
} | } | |||
else if ((tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE) != 0) | else if ((tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE) != 0) | |||
{ | { | |||
fprintf (killLogFilePtr, "%d.Service is running!\n", trialCount); | FPRINTF (killLogFilePtr, "%d.Service is running!\n", trialCount); | |||
} | } | |||
#endif | #endif | |||
GNUNET_SCHEDULER_add_now (&kill_task, &a); | GNUNET_SCHEDULER_add_now (&kill_task, &a); | |||
} | } | |||
static void | static void | |||
do_test (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) | do_test (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
{ | { | |||
GNUNET_CLIENT_service_test ("do-nothing", cfg, TIMEOUT, | GNUNET_CLIENT_service_test ("do-nothing", cfg, TIMEOUT, | |||
&do_nothing_restarted_notify_task, NULL); | &do_nothing_restarted_notify_task, NULL); | |||
skipping to change at line 336 | skipping to change at line 336 | |||
static void | static void | |||
kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) | kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
{ | { | |||
static struct GNUNET_CLIENT_Connection *doNothingConnection = NULL; | static struct GNUNET_CLIENT_Connection *doNothingConnection = NULL; | |||
if (NULL != cbData) | if (NULL != cbData) | |||
{ | { | |||
waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt); | waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt); | |||
#if LOG_BACKOFF | #if LOG_BACKOFF | |||
fprintf (killLogFilePtr, "Waited for: %llu ms\n", | FPRINTF (killLogFilePtr, "Waited for: %llu ms\n", | |||
(unsigned long long) waitedFor.rel_value); | (unsigned long long) waitedFor.rel_value); | |||
#endif | #endif | |||
} | } | |||
else | else | |||
{ | { | |||
waitedFor.rel_value = 0; | waitedFor.rel_value = 0; | |||
} | } | |||
/* Connect to the doNothing task */ | /* Connect to the doNothing task */ | |||
doNothingConnection = GNUNET_CLIENT_connect ("do-nothing", cfg); | doNothingConnection = GNUNET_CLIENT_connect ("do-nothing", cfg); | |||
GNUNET_assert (doNothingConnection != NULL); | GNUNET_assert (doNothingConnection != NULL); | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |