diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-04-19 19:06:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-04-19 19:06:06 +0000 |
commit | 88bf2770df46cdb1039818c1e52c25e106f0f5e9 (patch) | |
tree | c8595a683956d0a49302cd536645a3f77b345295 /src/datastore/datastore_api.c | |
parent | f4597fd17ae8d47e8b496d5992b81c15214fd3de (diff) | |
download | gnunet-88bf2770df46cdb1039818c1e52c25e106f0f5e9.tar.gz gnunet-88bf2770df46cdb1039818c1e52c25e106f0f5e9.zip |
-fix
Diffstat (limited to 'src/datastore/datastore_api.c')
-rw-r--r-- | src/datastore/datastore_api.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index f4096c665..f9d4dff7e 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -270,6 +270,22 @@ GNUNET_DATASTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
270 | 270 | ||
271 | 271 | ||
272 | /** | 272 | /** |
273 | * Task used by 'transmit_drop' to disconnect the datastore. | ||
274 | * | ||
275 | * @param cls the datastore handle | ||
276 | * @param tc scheduler context | ||
277 | */ | ||
278 | static void | ||
279 | disconnect_after_drop (void *cls, | ||
280 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
281 | { | ||
282 | struct GNUNET_DATASTORE_Handle *h = cls; | ||
283 | |||
284 | GNUNET_DATASTORE_disconnect (h, GNUNET_NO); | ||
285 | } | ||
286 | |||
287 | |||
288 | /** | ||
273 | * Transmit DROP message to datastore service. | 289 | * Transmit DROP message to datastore service. |
274 | * | 290 | * |
275 | * @param cls the 'struct GNUNET_DATASTORE_Handle' | 291 | * @param cls the 'struct GNUNET_DATASTORE_Handle' |
@@ -287,14 +303,16 @@ transmit_drop (void *cls, size_t size, void *buf) | |||
287 | { | 303 | { |
288 | LOG (GNUNET_ERROR_TYPE_WARNING, | 304 | LOG (GNUNET_ERROR_TYPE_WARNING, |
289 | _("Failed to transmit request to drop database.\n")); | 305 | _("Failed to transmit request to drop database.\n")); |
290 | GNUNET_DATASTORE_disconnect (h, GNUNET_NO); | 306 | GNUNET_SCHEDULER_add_continuation (&disconnect_after_drop, h, |
307 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
291 | return 0; | 308 | return 0; |
292 | } | 309 | } |
293 | GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); | 310 | GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); |
294 | hdr = buf; | 311 | hdr = buf; |
295 | hdr->size = htons (sizeof (struct GNUNET_MessageHeader)); | 312 | hdr->size = htons (sizeof (struct GNUNET_MessageHeader)); |
296 | hdr->type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_DROP); | 313 | hdr->type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_DROP); |
297 | GNUNET_DATASTORE_disconnect (h, GNUNET_NO); | 314 | GNUNET_SCHEDULER_add_continuation (&disconnect_after_drop, h, |
315 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
298 | return sizeof (struct GNUNET_MessageHeader); | 316 | return sizeof (struct GNUNET_MessageHeader); |
299 | } | 317 | } |
300 | 318 | ||