diff options
-rw-r--r-- | src/fs/fs_publish_ublock.c | 61 | ||||
-rw-r--r-- | src/fs/gnunet-publish.c | 3 | ||||
-rw-r--r-- | src/fs/test_fs_uri.c | 2 |
3 files changed, 54 insertions, 12 deletions
diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c index 25213f2ca..4399b8c8e 100644 --- a/src/fs/fs_publish_ublock.c +++ b/src/fs/fs_publish_ublock.c | |||
@@ -108,11 +108,17 @@ struct GNUNET_FS_PublishUblockContext | |||
108 | * Handle for active datastore operation. | 108 | * Handle for active datastore operation. |
109 | */ | 109 | */ |
110 | struct GNUNET_DATASTORE_QueueEntry *qre; | 110 | struct GNUNET_DATASTORE_QueueEntry *qre; |
111 | |||
112 | /** | ||
113 | * Task to run continuation asynchronously. | ||
114 | */ | ||
115 | GNUNET_SCHEDULER_TaskIdentifier task; | ||
116 | |||
111 | }; | 117 | }; |
112 | 118 | ||
113 | 119 | ||
114 | /** | 120 | /** |
115 | * Continuation of "GNUNET_FS_publish_ublock_". | 121 | * Continuation of #GNUNET_FS_publish_ublock_(). |
116 | * | 122 | * |
117 | * @param cls closure of type "struct GNUNET_FS_PublishUblockContext*" | 123 | * @param cls closure of type "struct GNUNET_FS_PublishUblockContext*" |
118 | * @param success GNUNET_SYSERR on failure (including timeout/queue drop) | 124 | * @param success GNUNET_SYSERR on failure (including timeout/queue drop) |
@@ -138,6 +144,24 @@ ublock_put_cont (void *cls, | |||
138 | 144 | ||
139 | 145 | ||
140 | /** | 146 | /** |
147 | * Run the continuation. | ||
148 | * | ||
149 | * @param cls the `struct GNUNET_FS_PublishUblockContext *` | ||
150 | * @param tc scheduler context | ||
151 | */ | ||
152 | static void | ||
153 | run_cont (void *cls, | ||
154 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
155 | { | ||
156 | struct GNUNET_FS_PublishUblockContext *uc = cls; | ||
157 | |||
158 | uc->task = GNUNET_SCHEDULER_NO_TASK; | ||
159 | uc->cont (uc->cont_cls, NULL); | ||
160 | GNUNET_free (uc); | ||
161 | } | ||
162 | |||
163 | |||
164 | /** | ||
141 | * Publish a UBlock. | 165 | * Publish a UBlock. |
142 | * | 166 | * |
143 | * @param h handle to the file sharing subsystem | 167 | * @param h handle to the file sharing subsystem |
@@ -258,14 +282,26 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, | |||
258 | uc = GNUNET_new (struct GNUNET_FS_PublishUblockContext); | 282 | uc = GNUNET_new (struct GNUNET_FS_PublishUblockContext); |
259 | uc->cont = cont; | 283 | uc->cont = cont; |
260 | uc->cont_cls = cont_cls; | 284 | uc->cont_cls = cont_cls; |
261 | uc->qre = | 285 | if (NULL != dsh) |
262 | GNUNET_DATASTORE_put (dsh, 0, &query, | 286 | { |
263 | ulen + slen + mdsize + sizeof (struct UBlock), | 287 | uc->qre = |
264 | ub_enc, GNUNET_BLOCK_TYPE_FS_UBLOCK, | 288 | GNUNET_DATASTORE_put (dsh, 0, &query, |
265 | bo->content_priority, bo->anonymity_level, | 289 | ulen + slen + mdsize + sizeof (struct UBlock), |
266 | bo->replication_level, bo->expiration_time, | 290 | ub_enc, |
267 | -2, 1, GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 291 | GNUNET_BLOCK_TYPE_FS_UBLOCK, |
268 | &ublock_put_cont, uc); | 292 | bo->content_priority, |
293 | bo->anonymity_level, | ||
294 | bo->replication_level, | ||
295 | bo->expiration_time, | ||
296 | -2, 1, | ||
297 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | ||
298 | &ublock_put_cont, uc); | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | uc->task = GNUNET_SCHEDULER_add_now (&run_cont, | ||
303 | uc); | ||
304 | } | ||
269 | return uc; | 305 | return uc; |
270 | } | 306 | } |
271 | 307 | ||
@@ -278,6 +314,11 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, | |||
278 | void | 314 | void |
279 | GNUNET_FS_publish_ublock_cancel_ (struct GNUNET_FS_PublishUblockContext *uc) | 315 | GNUNET_FS_publish_ublock_cancel_ (struct GNUNET_FS_PublishUblockContext *uc) |
280 | { | 316 | { |
281 | GNUNET_DATASTORE_cancel (uc->qre); | 317 | if (NULL != uc->qre) |
318 | GNUNET_DATASTORE_cancel (uc->qre); | ||
319 | if (GNUNET_SCHEDULER_NO_TASK != uc->task) | ||
320 | GNUNET_SCHEDULER_cancel (uc->task); | ||
282 | GNUNET_free (uc); | 321 | GNUNET_free (uc); |
283 | } | 322 | } |
323 | |||
324 | /* end of fs_publish_ublock.c */ | ||
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 12d9a6084..f192a0a90 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c | |||
@@ -448,7 +448,8 @@ uri_sks_continuation (void *cls, const struct GNUNET_FS_Uri *sks_uri, | |||
448 | * @param emsg error message, NULL on success | 448 | * @param emsg error message, NULL on success |
449 | */ | 449 | */ |
450 | static void | 450 | static void |
451 | uri_ksk_continuation (void *cls, const struct GNUNET_FS_Uri *ksk_uri, | 451 | uri_ksk_continuation (void *cls, |
452 | const struct GNUNET_FS_Uri *ksk_uri, | ||
452 | const char *emsg) | 453 | const char *emsg) |
453 | { | 454 | { |
454 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; | 455 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; |
diff --git a/src/fs/test_fs_uri.c b/src/fs/test_fs_uri.c index bef60f4e6..b9296bcb6 100644 --- a/src/fs/test_fs_uri.c +++ b/src/fs/test_fs_uri.c | |||
@@ -85,7 +85,7 @@ testLocation () | |||
85 | 85 | ||
86 | baseURI = | 86 | baseURI = |
87 | GNUNET_FS_uri_parse | 87 | GNUNET_FS_uri_parse |
88 | ("gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.42", | 88 | ("gnunet://fs/chk/4QZP479A9SKGFNMQ2ZBCYE71YV2QMTVGWTVPB6A10ASVCKXDHB05DKPSC7ZF6E9P9W1VE47394EQY7NXA47Q6R35M7P1MJPGP59D1Z8.D54QD1K5XCG5878T6YZ19AM60MQ6FC0YNVK7QY08KK0KM0FJJ3KQWYG112FN5T07KN7J0X35DF6WVBT9B8ZMZ3X2BXJ22X3KFQ6MV2G.15999", |
89 | &emsg); | 89 | &emsg); |
90 | GNUNET_assert (baseURI != NULL); | 90 | GNUNET_assert (baseURI != NULL); |
91 | GNUNET_assert (emsg == NULL); | 91 | GNUNET_assert (emsg == NULL); |