diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-05-14 11:20:29 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-05-14 11:20:29 +0000 |
commit | cced1cd7e8a319105177e29cc4f1720739e307bb (patch) | |
tree | fd712679c47946af449f03bf3684cc3bfa31388a /src/fs/fs_namespace.c | |
parent | 5e6ff76c94890e47b51f8bd555437c0ee181e851 (diff) | |
download | gnunet-cced1cd7e8a319105177e29cc4f1720739e307bb.tar.gz gnunet-cced1cd7e8a319105177e29cc4f1720739e307bb.zip |
fixes
Diffstat (limited to 'src/fs/fs_namespace.c')
-rw-r--r-- | src/fs/fs_namespace.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index 9e198adc2..e8b97bb19 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c | |||
@@ -79,6 +79,11 @@ struct AdvertisementContext | |||
79 | struct GNUNET_DATASTORE_Handle *dsh; | 79 | struct GNUNET_DATASTORE_Handle *dsh; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Our scheduler. | ||
83 | */ | ||
84 | struct GNUNET_SCHEDULER_Handle *sched; | ||
85 | |||
86 | /** | ||
82 | * Our KSK URI. | 87 | * Our KSK URI. |
83 | */ | 88 | */ |
84 | struct GNUNET_FS_Uri *ksk_uri; | 89 | struct GNUNET_FS_Uri *ksk_uri; |
@@ -126,6 +131,23 @@ struct AdvertisementContext | |||
126 | 131 | ||
127 | 132 | ||
128 | /** | 133 | /** |
134 | * Disconnect from the datastore. | ||
135 | * | ||
136 | * @param cls datastore handle | ||
137 | * @param tc scheduler context | ||
138 | */ | ||
139 | static void | ||
140 | do_disconnect (void *cls, | ||
141 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
142 | { | ||
143 | struct GNUNET_DATASTORE_Handle *dsh = cls; | ||
144 | |||
145 | GNUNET_DATASTORE_disconnect (dsh, | ||
146 | GNUNET_NO); | ||
147 | } | ||
148 | |||
149 | |||
150 | /** | ||
129 | * Continuation called to notify client about result of the | 151 | * Continuation called to notify client about result of the |
130 | * operation. | 152 | * operation. |
131 | * | 153 | * |
@@ -149,7 +171,10 @@ advertisement_cont (void *cls, | |||
149 | if (GNUNET_OK != success) | 171 | if (GNUNET_OK != success) |
150 | { | 172 | { |
151 | /* error! */ | 173 | /* error! */ |
152 | GNUNET_DATASTORE_disconnect (ac->dsh, GNUNET_NO); | 174 | GNUNET_SCHEDULER_add_continuation (ac->sched, |
175 | &do_disconnect, | ||
176 | ac->dsh, | ||
177 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
153 | ac->cont (ac->cont_cls, NULL, msg); | 178 | ac->cont (ac->cont_cls, NULL, msg); |
154 | GNUNET_FS_uri_destroy (ac->ksk_uri); | 179 | GNUNET_FS_uri_destroy (ac->ksk_uri); |
155 | GNUNET_free (ac->pt); | 180 | GNUNET_free (ac->pt); |
@@ -161,7 +186,10 @@ advertisement_cont (void *cls, | |||
161 | if (ac->pos == ac->ksk_uri->data.ksk.keywordCount) | 186 | if (ac->pos == ac->ksk_uri->data.ksk.keywordCount) |
162 | { | 187 | { |
163 | /* done! */ | 188 | /* done! */ |
164 | GNUNET_DATASTORE_disconnect (ac->dsh, GNUNET_NO); | 189 | GNUNET_SCHEDULER_add_continuation (ac->sched, |
190 | &do_disconnect, | ||
191 | ac->dsh, | ||
192 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
165 | ac->cont (ac->cont_cls, ac->ksk_uri, NULL); | 193 | ac->cont (ac->cont_cls, ac->ksk_uri, NULL); |
166 | GNUNET_FS_uri_destroy (ac->ksk_uri); | 194 | GNUNET_FS_uri_destroy (ac->ksk_uri); |
167 | GNUNET_free (ac->pt); | 195 | GNUNET_free (ac->pt); |
@@ -296,6 +324,7 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | |||
296 | ctx->cont = cont; | 324 | ctx->cont = cont; |
297 | ctx->cont_cls = cont_cls; | 325 | ctx->cont_cls = cont_cls; |
298 | ctx->dsh = dsh; | 326 | ctx->dsh = dsh; |
327 | ctx->sched = h->sched; | ||
299 | ctx->ksk_uri = GNUNET_FS_uri_dup (ksk_uri); | 328 | ctx->ksk_uri = GNUNET_FS_uri_dup (ksk_uri); |
300 | ctx->nb = nb; | 329 | ctx->nb = nb; |
301 | ctx->pt = pt; | 330 | ctx->pt = pt; |