test_fs_search_persistence.c | test_fs_search_persistence.c | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
* @file fs/test_fs_search_persistence.c | * @file fs/test_fs_search_persistence.c | |||
* @brief simple testcase for persistence of search operation | * @brief simple testcase for persistence of search operation | |||
* @author Christian Grothoff | * @author Christian Grothoff | |||
*/ | */ | |||
#include "platform.h" | #include "platform.h" | |||
#include "gnunet_util_lib.h" | #include "gnunet_util_lib.h" | |||
#include "gnunet_arm_service.h" | #include "gnunet_arm_service.h" | |||
#include "gnunet_fs_service.h" | #include "gnunet_fs_service.h" | |||
#define VERBOSE GNUNET_EXTRA_LOGGING | #define VERBOSE GNUNET_NO | |||
#define START_ARM GNUNET_YES | #define START_ARM GNUNET_YES | |||
/** | /** | |||
* File-size we use for testing. | * File-size we use for testing. | |||
*/ | */ | |||
#define FILESIZE 1024 | #define FILESIZE 1024 | |||
/** | /** | |||
* How long until we give up on transmitting the message? | * How long until we give up on transmitting the message? | |||
skipping to change at line 166 | skipping to change at line 166 | |||
case GNUNET_FS_STATUS_SEARCH_RESULT: | case GNUNET_FS_STATUS_SEARCH_RESULT: | |||
/* FIXME: consider_restart (event->status); cannot be tested with | /* FIXME: consider_restart (event->status); cannot be tested with | |||
* search result since we exit here after the first one... */ | * search result since we exit here after the first one... */ | |||
#if VERBOSE | #if VERBOSE | |||
printf ("Search complete.\n"); | printf ("Search complete.\n"); | |||
#endif | #endif | |||
GNUNET_SCHEDULER_add_continuation (&abort_search_task, NULL, | GNUNET_SCHEDULER_add_continuation (&abort_search_task, NULL, | |||
GNUNET_SCHEDULER_REASON_PREREQ_DONE) ; | GNUNET_SCHEDULER_REASON_PREREQ_DONE) ; | |||
break; | break; | |||
case GNUNET_FS_STATUS_PUBLISH_ERROR: | case GNUNET_FS_STATUS_PUBLISH_ERROR: | |||
fprintf (stderr, "Error publishing file: %s\n", | FPRINTF (stderr, "Error publishing file: %s\n", | |||
event->value.publish.specifics.error.message); | event->value.publish.specifics.error.message); | |||
GNUNET_break (0); | GNUNET_break (0); | |||
GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL, | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL, | |||
GNUNET_SCHEDULER_REASON_PREREQ_DONE) ; | GNUNET_SCHEDULER_REASON_PREREQ_DONE) ; | |||
break; | break; | |||
case GNUNET_FS_STATUS_SEARCH_ERROR: | case GNUNET_FS_STATUS_SEARCH_ERROR: | |||
fprintf (stderr, "Error searching file: %s\n", | FPRINTF (stderr, "Error searching file: %s\n", | |||
event->value.search.specifics.error.message); | event->value.search.specifics.error.message); | |||
GNUNET_SCHEDULER_add_continuation (&abort_search_task, NULL, | GNUNET_SCHEDULER_add_continuation (&abort_search_task, NULL, | |||
GNUNET_SCHEDULER_REASON_PREREQ_DONE) ; | GNUNET_SCHEDULER_REASON_PREREQ_DONE) ; | |||
break; | break; | |||
case GNUNET_FS_STATUS_SEARCH_SUSPEND: | case GNUNET_FS_STATUS_SEARCH_SUSPEND: | |||
if (event->value.search.sc == search) | if (event->value.search.sc == search) | |||
search = NULL; | search = NULL; | |||
break; | break; | |||
case GNUNET_FS_STATUS_SEARCH_RESUME: | case GNUNET_FS_STATUS_SEARCH_RESUME: | |||
if (NULL == search) | if (NULL == search) | |||
skipping to change at line 219 | skipping to change at line 219 | |||
break; | break; | |||
case GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED: | case GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED: | |||
break; | break; | |||
case GNUNET_FS_STATUS_SEARCH_STOPPED: | case GNUNET_FS_STATUS_SEARCH_STOPPED: | |||
GNUNET_assert (search == event->value.search.sc); | GNUNET_assert (search == event->value.search.sc); | |||
GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL, | GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL, | |||
GNUNET_SCHEDULER_REASON_PREREQ_DONE) ; | GNUNET_SCHEDULER_REASON_PREREQ_DONE) ; | |||
search = NULL; | search = NULL; | |||
break; | break; | |||
default: | default: | |||
fprintf (stderr, "Unexpected event: %d\n", event->status); | FPRINTF (stderr, "Unexpected event: %d\n", event->status); | |||
break; | break; | |||
} | } | |||
return NULL; | return NULL; | |||
} | } | |||
static void | static void | |||
setup_peer (struct PeerContext *p, const char *cfgname) | setup_peer (struct PeerContext *p, const char *cfgname) | |||
{ | { | |||
p->cfg = GNUNET_CONFIGURATION_create (); | p->cfg = GNUNET_CONFIGURATION_create (); | |||
#if START_ARM | #if START_ARM | |||
p->arm_proc = | p->arm_proc = | |||
GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm" , | |||
"gnunet-service-arm", | "gnunet-service-arm", | |||
#if VERBOSE | #if VERBOSE | |||
"-L", "DEBUG", | "-L", "DEBUG", | |||
#endif | #endif | |||
"-c", cfgname, NULL); | "-c", cfgname, NULL); | |||
#endif | #endif | |||
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | |||
} | } | |||
static void | static void | |||
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/ |