diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-03-28 14:10:02 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-03-28 14:10:02 +0000 |
commit | 677157767fc70a2176ecffadf60dc0fdf4eda5f8 (patch) | |
tree | dc35e3bdffd4b78a98876084599058ec48dfcc15 /src/fs/test_fs_search_probes.c | |
parent | 87d828d4d8615c4958684f225c3917ff7516519b (diff) | |
download | gnunet-677157767fc70a2176ecffadf60dc0fdf4eda5f8.tar.gz gnunet-677157767fc70a2176ecffadf60dc0fdf4eda5f8.zip |
-timeout
Diffstat (limited to 'src/fs/test_fs_search_probes.c')
-rw-r--r-- | src/fs/test_fs_search_probes.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/fs/test_fs_search_probes.c b/src/fs/test_fs_search_probes.c index 0b02532e8..b2f1e0bf1 100644 --- a/src/fs/test_fs_search_probes.c +++ b/src/fs/test_fs_search_probes.c | |||
@@ -53,6 +53,29 @@ static struct GNUNET_FS_SearchContext *search; | |||
53 | 53 | ||
54 | static struct GNUNET_FS_PublishContext *publish; | 54 | static struct GNUNET_FS_PublishContext *publish; |
55 | 55 | ||
56 | static GNUNET_SCHEDULER_TaskIdentifier timeout_task; | ||
57 | |||
58 | static int err; | ||
59 | |||
60 | |||
61 | static void | ||
62 | abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
63 | { | ||
64 | fprintf (stderr, | ||
65 | "Timeout\n"); | ||
66 | if (NULL != publish) | ||
67 | { | ||
68 | GNUNET_FS_publish_stop (publish); | ||
69 | publish = NULL; | ||
70 | } | ||
71 | if (NULL != search) | ||
72 | { | ||
73 | GNUNET_FS_search_stop (search); | ||
74 | search = NULL; | ||
75 | } | ||
76 | err = 1; | ||
77 | } | ||
78 | |||
56 | 79 | ||
57 | static void | 80 | static void |
58 | abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 81 | abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
@@ -194,6 +217,8 @@ run (void *cls, | |||
194 | GNUNET_FS_publish_start (fs, fi, NULL, NULL, NULL, | 217 | GNUNET_FS_publish_start (fs, fi, NULL, NULL, NULL, |
195 | GNUNET_FS_PUBLISH_OPTION_NONE); | 218 | GNUNET_FS_PUBLISH_OPTION_NONE); |
196 | GNUNET_assert (publish != NULL); | 219 | GNUNET_assert (publish != NULL); |
220 | timeout_task = GNUNET_SCHEDULER_add_delayed (LIFETIME, | ||
221 | &abort_error, NULL); | ||
197 | } | 222 | } |
198 | 223 | ||
199 | 224 | ||
@@ -204,7 +229,7 @@ main (int argc, char *argv[]) | |||
204 | "test_fs_search_data.conf", | 229 | "test_fs_search_data.conf", |
205 | &run, NULL)) | 230 | &run, NULL)) |
206 | return 1; | 231 | return 1; |
207 | return 0; | 232 | return err; |
208 | } | 233 | } |
209 | 234 | ||
210 | /* end of test_fs_search_probes.c */ | 235 | /* end of test_fs_search_probes.c */ |