aboutsummaryrefslogtreecommitdiff
path: root/src/set/test_set_union_copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/set/test_set_union_copy.c')
-rw-r--r--src/set/test_set_union_copy.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/set/test_set_union_copy.c b/src/set/test_set_union_copy.c
index fdf6bf9df..7fedf426b 100644
--- a/src/set/test_set_union_copy.c
+++ b/src/set/test_set_union_copy.c
@@ -42,6 +42,8 @@ static struct GNUNET_SET_Handle *set2;
42 42
43static const struct GNUNET_CONFIGURATION_Handle *config; 43static const struct GNUNET_CONFIGURATION_Handle *config;
44 44
45static struct GNUNET_SCHEDULER_Task *tt;
46
45 47
46static void 48static void
47add_element_str (struct GNUNET_SET_Handle *set, char *str) 49add_element_str (struct GNUNET_SET_Handle *set, char *str)
@@ -77,11 +79,7 @@ remove_element_str (struct GNUNET_SET_Handle *set, char *str)
77static void 79static void
78timeout_fail (void *cls) 80timeout_fail (void *cls)
79{ 81{
80 const struct GNUNET_SCHEDULER_TaskContext *tc; 82 tt = NULL;
81
82 tc = GNUNET_SCHEDULER_get_task_context ();
83 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
84 return;
85 GNUNET_SCHEDULER_shutdown (); 83 GNUNET_SCHEDULER_shutdown ();
86 ret = 1; 84 ret = 1;
87} 85}
@@ -125,8 +123,7 @@ check_count_iter (void *cls,
125} 123}
126 124
127 125
128 126static void
129void
130check_count (struct GNUNET_SET_Handle *set, 127check_count (struct GNUNET_SET_Handle *set,
131 char *what, 128 char *what,
132 unsigned int expected_count, 129 unsigned int expected_count,
@@ -145,24 +142,28 @@ check_count (struct GNUNET_SET_Handle *set,
145} 142}
146 143
147 144
148void test_done (void *cls) 145static void
146test_done (void *cls)
149{ 147{
150 if (NULL != set1) 148 if (NULL != set1)
151 GNUNET_SET_destroy (set1); 149 GNUNET_SET_destroy (set1);
152 if (NULL != set2) 150 if (NULL != set2)
153 GNUNET_SET_destroy (set2); 151 GNUNET_SET_destroy (set2);
154 152 GNUNET_SCHEDULER_cancel (tt);
153 tt = NULL;
155 GNUNET_SCHEDULER_shutdown (); 154 GNUNET_SCHEDULER_shutdown ();
156} 155}
157 156
158 157
159void check_new_set_count (void *cls) 158static void
159check_new_set_count (void *cls)
160{ 160{
161 check_count (set2, "new set", 4, &test_done, NULL); 161 check_count (set2, "new set", 4, &test_done, NULL);
162} 162}
163 163
164 164
165void copy_done (void *cls, struct GNUNET_SET_Handle *new_set) 165static void
166copy_done (void *cls, struct GNUNET_SET_Handle *new_set)
166{ 167{
167 printf ("copy done\n"); 168 printf ("copy done\n");
168 set2 = new_set; 169 set2 = new_set;
@@ -177,7 +178,8 @@ void copy_done (void *cls, struct GNUNET_SET_Handle *new_set)
177} 178}
178 179
179 180
180void test_copy (void *cls) 181static void
182test_copy (void *cls)
181{ 183{
182 printf ("about to copy\n"); 184 printf ("about to copy\n");
183 GNUNET_SET_copy_lazy (set1, copy_done, NULL); 185 GNUNET_SET_copy_lazy (set1, copy_done, NULL);
@@ -198,9 +200,9 @@ run (void *cls,
198 const struct GNUNET_CONFIGURATION_Handle *cfg, 200 const struct GNUNET_CONFIGURATION_Handle *cfg,
199 struct GNUNET_TESTING_Peer *peer) 201 struct GNUNET_TESTING_Peer *peer)
200{ 202{
201 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5), 203 tt = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5),
202 &timeout_fail, 204 &timeout_fail,
203 NULL); 205 NULL);
204 206
205 config = cfg; 207 config = cfg;
206 GNUNET_TESTING_peer_get_identity (peer, 208 GNUNET_TESTING_peer_get_identity (peer,