diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-08-03 09:35:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-08-03 09:35:48 +0000 |
commit | d3e7a5e40dd2d5409009a30e1e41148c4d852673 (patch) | |
tree | 21ff19580a99137e9b8aec4393feb67f0f1c7b5a /src/fs/test_fs_test_lib.c | |
parent | ec69ceabc67a72373a2579d871c5fe85676a73bd (diff) | |
download | gnunet-d3e7a5e40dd2d5409009a30e1e41148c4d852673.tar.gz gnunet-d3e7a5e40dd2d5409009a30e1e41148c4d852673.zip |
-use simpler, modern scheduler API
Diffstat (limited to 'src/fs/test_fs_test_lib.c')
-rw-r--r-- | src/fs/test_fs_test_lib.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/fs/test_fs_test_lib.c b/src/fs/test_fs_test_lib.c index bc950ed75..3f802bfcf 100644 --- a/src/fs/test_fs_test_lib.c +++ b/src/fs/test_fs_test_lib.c | |||
@@ -44,22 +44,28 @@ | |||
44 | 44 | ||
45 | static struct GNUNET_TESTBED_Peer *the_peers[NUM_DAEMONS]; | 45 | static struct GNUNET_TESTBED_Peer *the_peers[NUM_DAEMONS]; |
46 | 46 | ||
47 | static struct GNUNET_TIME_Absolute start_time; | ||
48 | |||
47 | static int ret; | 49 | static int ret; |
48 | 50 | ||
49 | 51 | ||
50 | static void | 52 | static void |
51 | do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 53 | do_stop (void *cls, |
54 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
52 | { | 55 | { |
53 | char *fn = cls; | 56 | char *fn = cls; |
54 | 57 | ||
55 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) | 58 | if (0 == |
59 | GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_add (start_time, | ||
60 | TIMEOUT)).rel_value_us) | ||
56 | { | 61 | { |
57 | GNUNET_break (0); | 62 | GNUNET_break (0); |
58 | ret = 1; | 63 | ret = 1; |
59 | } | 64 | } |
60 | else | 65 | else |
61 | { | 66 | { |
62 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n", | 67 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
68 | "Finished download, shutting down\n", | ||
63 | (unsigned long long) FILESIZE); | 69 | (unsigned long long) FILESIZE); |
64 | } | 70 | } |
65 | if (NULL != fn) | 71 | if (NULL != fn) |
@@ -72,7 +78,8 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
72 | 78 | ||
73 | 79 | ||
74 | static void | 80 | static void |
75 | do_download (void *cls, const struct GNUNET_FS_Uri *uri, | 81 | do_download (void *cls, |
82 | const struct GNUNET_FS_Uri *uri, | ||
76 | const char *fn) | 83 | const char *fn) |
77 | { | 84 | { |
78 | if (NULL == uri) | 85 | if (NULL == uri) |
@@ -82,9 +89,15 @@ do_download (void *cls, const struct GNUNET_FS_Uri *uri, | |||
82 | ret = 1; | 89 | ret = 1; |
83 | return; | 90 | return; |
84 | } | 91 | } |
85 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Downloading %llu bytes\n", | 92 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
93 | "Downloading %llu bytes\n", | ||
86 | (unsigned long long) FILESIZE); | 94 | (unsigned long long) FILESIZE); |
87 | GNUNET_FS_TEST_download (the_peers[0], TIMEOUT, 1, SEED, uri, VERBOSE, &do_stop, | 95 | start_time = GNUNET_TIME_absolute_get (); |
96 | GNUNET_FS_TEST_download (the_peers[0], | ||
97 | TIMEOUT, 1, SEED, | ||
98 | uri, | ||
99 | VERBOSE, | ||
100 | &do_stop, | ||
88 | (NULL == fn) ? NULL : GNUNET_strdup (fn)); | 101 | (NULL == fn) ? NULL : GNUNET_strdup (fn)); |
89 | } | 102 | } |
90 | 103 | ||