aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-30 08:17:37 +0000
committerChristian Grothoff <christian@grothoff.org>2016-04-30 08:17:37 +0000
commit95f9076a2139f5fb042b944a0658b6cda2fa35db (patch)
treeb0826a2a1dcf812e6b4450fe6b05d47cd53ae49d /src/datastore
parent7746f68db77b9ca3c4aaca24ab2ce5253461240b (diff)
downloadgnunet-95f9076a2139f5fb042b944a0658b6cda2fa35db.tar.gz
gnunet-95f9076a2139f5fb042b944a0658b6cda2fa35db.zip
implementing new scheduler shutdown semantics
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/gnunet-datastore.c3
-rw-r--r--src/datastore/gnunet-service-datastore.c9
-rw-r--r--src/datastore/perf_datastore_api.c4
-rw-r--r--src/datastore/perf_plugin_datastore.c45
-rw-r--r--src/datastore/test_plugin_datastore.c7
5 files changed, 33 insertions, 35 deletions
diff --git a/src/datastore/gnunet-datastore.c b/src/datastore/gnunet-datastore.c
index 186889e4c..ddca4ee06 100644
--- a/src/datastore/gnunet-datastore.c
+++ b/src/datastore/gnunet-datastore.c
@@ -224,8 +224,7 @@ run (void *cls, char *const *args, const char *cfgfile,
224 ret = 1; 224 ret = 1;
225 return; 225 return;
226 } 226 }
227 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 227 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
228 &do_shutdown, NULL);
229 do_get (); 228 do_get ();
230} 229}
231 230
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index fdccd925e..6ebfba7fc 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -391,7 +391,9 @@ static void
391delete_expired (void *cls) 391delete_expired (void *cls)
392{ 392{
393 expired_kill_task = NULL; 393 expired_kill_task = NULL;
394 plugin->api->get_expiration (plugin->api->cls, &expired_processor, NULL); 394 plugin->api->get_expiration (plugin->api->cls,
395 &expired_processor,
396 NULL);
395} 397}
396 398
397 399
@@ -1819,9 +1821,8 @@ run (void *cls,
1819 GNUNET_SERVER_disconnect_notify (server, 1821 GNUNET_SERVER_disconnect_notify (server,
1820 &cleanup_reservations, 1822 &cleanup_reservations,
1821 NULL); 1823 NULL);
1822 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 1824 GNUNET_SCHEDULER_add_shutdown (&cleaning_task,
1823 &cleaning_task, 1825 NULL);
1824 NULL);
1825} 1826}
1826 1827
1827 1828
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index 41cac1283..97774198c 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -351,11 +351,7 @@ run_continuation (void *cls)
351 static struct GNUNET_HashCode key; 351 static struct GNUNET_HashCode key;
352 static char data[65536]; 352 static char data[65536];
353 char gstr[128]; 353 char gstr[128];
354 const struct GNUNET_SCHEDULER_TaskContext *tc;
355 354
356 tc = GNUNET_SCHEDULER_get_task_context ();
357 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
358 crc->phase = RP_ERROR;
359 ok = (int) crc->phase; 355 ok = (int) crc->phase;
360 switch (crc->phase) 356 switch (crc->phase)
361 { 357 {
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index 0aeb426ab..cbc01844e 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -133,6 +133,7 @@ put_continuation (void *cls,
133 GNUNET_SCHEDULER_add_now (&test, crc); 133 GNUNET_SCHEDULER_add_now (&test, crc);
134} 134}
135 135
136
136static void 137static void
137do_put (struct CpsRunContext *crc) 138do_put (struct CpsRunContext *crc)
138{ 139{
@@ -195,9 +196,14 @@ do_put (struct CpsRunContext *crc)
195 196
196 197
197static int 198static int
198iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size, 199iterate_zeros (void *cls,
199 const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, 200 const struct GNUNET_HashCode *key,
200 uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, 201 uint32_t size,
202 const void *data,
203 enum GNUNET_BLOCK_Type type,
204 uint32_t priority,
205 uint32_t anonymity,
206 struct GNUNET_TIME_Absolute expiration,
201 uint64_t uid) 207 uint64_t uid)
202{ 208{
203 struct CpsRunContext *crc = cls; 209 struct CpsRunContext *crc = cls;
@@ -246,10 +252,15 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
246 252
247 253
248static int 254static int
249expiration_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size, 255expiration_get (void *cls,
250 const void *data, enum GNUNET_BLOCK_Type type, 256 const struct GNUNET_HashCode *key,
251 uint32_t priority, uint32_t anonymity, 257 uint32_t size,
252 struct GNUNET_TIME_Absolute expiration, uint64_t uid) 258 const void *data,
259 enum GNUNET_BLOCK_Type type,
260 uint32_t priority,
261 uint32_t anonymity,
262 struct GNUNET_TIME_Absolute expiration,
263 uint64_t uid)
253{ 264{
254 struct CpsRunContext *crc = cls; 265 struct CpsRunContext *crc = cls;
255 int i; 266 int i;
@@ -293,10 +304,15 @@ expiration_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
293 304
294 305
295static int 306static int
296replication_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size, 307replication_get (void *cls,
297 const void *data, enum GNUNET_BLOCK_Type type, 308 const struct GNUNET_HashCode *key,
298 uint32_t priority, uint32_t anonymity, 309 uint32_t size,
299 struct GNUNET_TIME_Absolute expiration, uint64_t uid) 310 const void *data,
311 enum GNUNET_BLOCK_Type type,
312 uint32_t priority,
313 uint32_t anonymity,
314 struct GNUNET_TIME_Absolute expiration,
315 uint64_t uid)
300{ 316{
301 struct CpsRunContext *crc = cls; 317 struct CpsRunContext *crc = cls;
302 int i; 318 int i;
@@ -388,14 +404,7 @@ static void
388test (void *cls) 404test (void *cls)
389{ 405{
390 struct CpsRunContext *crc = cls; 406 struct CpsRunContext *crc = cls;
391 const struct GNUNET_SCHEDULER_TaskContext *tc;
392 407
393 tc = GNUNET_SCHEDULER_get_task_context ();
394 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
395 {
396 GNUNET_break (0);
397 crc->phase = RP_ERROR;
398 }
399 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 408 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
400 "In phase %d, iteration %u\n", crc->phase, crc->cnt); 409 "In phase %d, iteration %u\n", crc->phase, crc->cnt);
401 switch (crc->phase) 410 switch (crc->phase)
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c
index d7dff1041..9ec0c53a2 100644
--- a/src/datastore/test_plugin_datastore.c
+++ b/src/datastore/test_plugin_datastore.c
@@ -267,14 +267,7 @@ test (void *cls)
267{ 267{
268 struct CpsRunContext *crc = cls; 268 struct CpsRunContext *crc = cls;
269 struct GNUNET_HashCode key; 269 struct GNUNET_HashCode key;
270 const struct GNUNET_SCHEDULER_TaskContext *tc;
271 270
272 tc = GNUNET_SCHEDULER_get_task_context ();
273 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
274 {
275 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test aborted.\n");
276 crc->phase = RP_ERROR;
277 }
278 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 271 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
279 "In phase %d, iteration %u\n", crc->phase, crc->cnt); 272 "In phase %d, iteration %u\n", crc->phase, crc->cnt);
280 switch (crc->phase) 273 switch (crc->phase)