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_gnunet_service_fs_p2p.c | |
parent | ec69ceabc67a72373a2579d871c5fe85676a73bd (diff) | |
download | gnunet-d3e7a5e40dd2d5409009a30e1e41148c4d852673.tar.gz gnunet-d3e7a5e40dd2d5409009a30e1e41148c4d852673.zip |
-use simpler, modern scheduler API
Diffstat (limited to 'src/fs/test_gnunet_service_fs_p2p.c')
-rw-r--r-- | src/fs/test_gnunet_service_fs_p2p.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c index ba3b8daab..57efbdcd6 100644 --- a/src/fs/test_gnunet_service_fs_p2p.c +++ b/src/fs/test_gnunet_service_fs_p2p.c | |||
@@ -61,24 +61,29 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
61 | char *fancy; | 61 | char *fancy; |
62 | 62 | ||
63 | GNUNET_SCHEDULER_shutdown (); | 63 | GNUNET_SCHEDULER_shutdown (); |
64 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) | 64 | if (0 == |
65 | GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_add (start_time, | ||
66 | TIMEOUT)).rel_value_us) | ||
67 | { | ||
68 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
69 | "Timeout during download, shutting down with error\n"); | ||
70 | ok = 1; | ||
71 | } | ||
72 | else | ||
65 | { | 73 | { |
66 | del = GNUNET_TIME_absolute_get_duration (start_time); | 74 | del = GNUNET_TIME_absolute_get_duration (start_time); |
67 | if (del.rel_value_us == 0) | 75 | if (0 == del.rel_value_us) |
68 | del.rel_value_us = 1; | 76 | del.rel_value_us = 1; |
69 | fancy = | 77 | fancy = |
70 | GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * | 78 | GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) * |
71 | 1000000LL / del.rel_value_us); | 79 | 1000000LL / del.rel_value_us); |
72 | FPRINTF (stdout, "Download speed was %s/s\n", fancy); | 80 | FPRINTF (stdout, |
81 | "Download speed was %s/s\n", | ||
82 | fancy); | ||
73 | GNUNET_free (fancy); | 83 | GNUNET_free (fancy); |
74 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n", | ||
75 | (unsigned long long) FILESIZE); | ||
76 | } | ||
77 | else | ||
78 | { | ||
79 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 84 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
80 | "Timeout during download, shutting down with error\n"); | 85 | "Finished download, shutting down\n", |
81 | ok = 1; | 86 | (unsigned long long) FILESIZE); |
82 | } | 87 | } |
83 | if (NULL != fn) | 88 | if (NULL != fn) |
84 | { | 89 | { |