diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-24 01:10:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-24 01:10:47 +0000 |
commit | f1f603c7d0b3f03dca46a4f313472288eb080eb1 (patch) | |
tree | 3a29966b02dfb83e0a8a8d5c42b3116380209fb0 /src/hostlist/test_gnunet_daemon_hostlist.c | |
parent | 53cd5b8eda2fa8db86b0907a62a39598981d008a (diff) | |
download | gnunet-f1f603c7d0b3f03dca46a4f313472288eb080eb1.tar.gz gnunet-f1f603c7d0b3f03dca46a4f313472288eb080eb1.zip |
making GNUNET_SCHEDULER_cancel() perform in O(1) instead of O(n) to help or even fully address #3247
Diffstat (limited to 'src/hostlist/test_gnunet_daemon_hostlist.c')
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c index a39f346ae..21cd164bc 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist.c +++ b/src/hostlist/test_gnunet_daemon_hostlist.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | static int ok; | 36 | static int ok; |
37 | 37 | ||
38 | static GNUNET_SCHEDULER_TaskIdentifier timeout_task; | 38 | static struct GNUNET_SCHEDULER_Task * timeout_task; |
39 | 39 | ||
40 | struct PeerContext | 40 | struct PeerContext |
41 | { | 41 | { |
@@ -83,7 +83,7 @@ clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
83 | static void | 83 | static void |
84 | timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 84 | timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
85 | { | 85 | { |
86 | timeout_task = GNUNET_SCHEDULER_NO_TASK; | 86 | timeout_task = NULL; |
87 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 87 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
88 | "Timeout trying to connect peers, test failed.\n"); | 88 | "Timeout trying to connect peers, test failed.\n"); |
89 | clean_up (NULL, tc); | 89 | clean_up (NULL, tc); |
@@ -106,10 +106,10 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
106 | return; | 106 | return; |
107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n"); | 107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n"); |
108 | ok = 0; | 108 | ok = 0; |
109 | if (timeout_task != GNUNET_SCHEDULER_NO_TASK) | 109 | if (timeout_task != NULL) |
110 | { | 110 | { |
111 | GNUNET_SCHEDULER_cancel (timeout_task); | 111 | GNUNET_SCHEDULER_cancel (timeout_task); |
112 | timeout_task = GNUNET_SCHEDULER_NO_TASK; | 112 | timeout_task = NULL; |
113 | } | 113 | } |
114 | GNUNET_SCHEDULER_add_now (&clean_up, NULL); | 114 | GNUNET_SCHEDULER_add_now (&clean_up, NULL); |
115 | } | 115 | } |