projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
-doxygen and indentation
[oweals/gnunet.git]
/
src
/
fs
/
test_fs_search_persistence.c
diff --git
a/src/fs/test_fs_search_persistence.c
b/src/fs/test_fs_search_persistence.c
index cedf4b8a5ebe87ccc1beab95168cc5c819af0fe9..38b350d22faea3ca2e37832f71168c287f1e7bbf 100644
(file)
--- a/
src/fs/test_fs_search_persistence.c
+++ b/
src/fs/test_fs_search_persistence.c
@@
-1,6
+1,6
@@
/*
This file is part of GNUnet.
/*
This file is part of GNUnet.
- (C) 2004, 2005, 2006, 2008, 2009, 2010 Christian Grothoff (and other contributing authors)
+
Copyright
(C) 2004, 2005, 2006, 2008, 2009, 2010 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@
-24,7
+24,7
@@
*/
#include "platform.h"
#include "gnunet_util_lib.h"
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_testing_lib
-new
.h"
+#include "gnunet_testing_lib.h"
#include "gnunet_fs_service.h"
#include "gnunet_fs_service.h"
@@
-54,21
+54,54
@@
static struct GNUNET_FS_PublishContext *publish;
static const struct GNUNET_CONFIGURATION_Handle *cfg;
static const struct GNUNET_CONFIGURATION_Handle *cfg;
+static struct GNUNET_SCHEDULER_Task * timeout_task;
+
+static int err;
+
+
+static void
+abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ timeout_task = NULL;
+ fprintf (stderr,
+ "Timeout\n");
+ if (NULL != search)
+ {
+ GNUNET_FS_search_stop (search);
+ search = NULL;
+ }
+ if (NULL != publish)
+ {
+ GNUNET_FS_publish_stop (publish);
+ publish = NULL;
+ }
+ err = 1;
+}
static void
abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
static void
abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- GNUNET_FS_publish_stop (publish);
- publish = NULL;
+ if (NULL != publish)
+ {
+ GNUNET_FS_publish_stop (publish);
+ publish = NULL;
+ }
+ if (NULL != timeout_task)
+ {
+ GNUNET_SCHEDULER_cancel (timeout_task);
+ timeout_task = NULL;
+ }
}
static void
abort_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
}
static void
abort_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- if (search != NULL)
+ if (NULL != search)
+ {
GNUNET_FS_search_stop (search);
GNUNET_FS_search_stop (search);
- search = NULL;
+ search = NULL;
+ }
}
}
@@
-127,6
+160,8
@@
progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
(unsigned long long) event->value.publish.specifics.
progress.offset);
break;
(unsigned long long) event->value.publish.specifics.
progress.offset);
break;
+ case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+ break;
case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
kuri = GNUNET_FS_uri_ksk_create_from_args (1, keywords);
start = GNUNET_TIME_absolute_get ();
case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
kuri = GNUNET_FS_uri_ksk_create_from_args (1, keywords);
start = GNUNET_TIME_absolute_get ();
@@
-214,7
+249,8
@@
progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
static void
run (void *cls,
static void
run (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *c)
+ const struct GNUNET_CONFIGURATION_Handle *c,
+ struct GNUNET_TESTING_Peer *peer)
{
const char *keywords[] = {
"down_foo",
{
const char *keywords[] = {
"down_foo",
@@
-251,6
+287,8
@@
run (void *cls,
GNUNET_FS_publish_start (fs, fi, NULL, NULL, NULL,
GNUNET_FS_PUBLISH_OPTION_NONE);
GNUNET_assert (publish != NULL);
GNUNET_FS_publish_start (fs, fi, NULL, NULL, NULL,
GNUNET_FS_PUBLISH_OPTION_NONE);
GNUNET_assert (publish != NULL);
+ timeout_task = GNUNET_SCHEDULER_add_delayed (LIFETIME,
+ &abort_error, NULL);
}
}
@@
-261,7
+299,7
@@
main (int argc, char *argv[])
"test_fs_search_data.conf",
&run, NULL))
return 1;
"test_fs_search_data.conf",
&run, NULL))
return 1;
- return
0
;
+ return
err
;
}
/* end of test_fs_search_persistence.c */
}
/* end of test_fs_search_persistence.c */