aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-07-04 08:37:33 +0000
committerChristian Grothoff <christian@grothoff.org>2012-07-04 08:37:33 +0000
commit2c3dfc2340b40258035f7d654d27249ca269ee3c (patch)
treee81ddb6be4424ca1e8d73d6ead6375be4aa57e40 /src/namestore
parent97603ca5d5e585cc9da4bcca28a399122dbce664 (diff)
downloadgnunet-2c3dfc2340b40258035f7d654d27249ca269ee3c.tar.gz
gnunet-2c3dfc2340b40258035f7d654d27249ca269ee3c.zip
-fixing #2478
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-namestore.c51
1 files changed, 41 insertions, 10 deletions
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 3ae10c541..cc6079895 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -64,6 +64,11 @@ static int add;
64static struct GNUNET_NAMESTORE_QueueEntry *add_qe; 64static struct GNUNET_NAMESTORE_QueueEntry *add_qe;
65 65
66/** 66/**
67 * Queue entry for the 'add-uri' operation.
68 */
69static struct GNUNET_NAMESTORE_QueueEntry *add_qe_uri;
70
71/**
67 * Desired action is to list records. 72 * Desired action is to list records.
68 */ 73 */
69static int list; 74static int list;
@@ -134,6 +139,26 @@ static void
134do_shutdown (void *cls, 139do_shutdown (void *cls,
135 const struct GNUNET_SCHEDULER_TaskContext *tc) 140 const struct GNUNET_SCHEDULER_TaskContext *tc)
136{ 141{
142 if (NULL != list_it)
143 {
144 GNUNET_NAMESTORE_zone_iteration_stop (list_it);
145 list_it = NULL;
146 }
147 if (NULL != add_qe)
148 {
149 GNUNET_NAMESTORE_cancel (add_qe);
150 add_qe = NULL;
151 }
152 if (NULL != add_qe_uri)
153 {
154 GNUNET_NAMESTORE_cancel (add_qe_uri);
155 add_qe_uri = NULL;
156 }
157 if (NULL != del_qe)
158 {
159 GNUNET_NAMESTORE_cancel (del_qe);
160 del_qe = NULL;
161 }
137 if (NULL != ns) 162 if (NULL != ns)
138 { 163 {
139 GNUNET_NAMESTORE_disconnect (ns); 164 GNUNET_NAMESTORE_disconnect (ns);
@@ -156,7 +181,7 @@ do_shutdown (void *cls,
156 * Continuation called to notify client about result of the 181 * Continuation called to notify client about result of the
157 * operation. 182 * operation.
158 * 183 *
159 * @param cls closure, unused 184 * @param cls closure, location of the QueueEntry pointer to NULL out
160 * @param success GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) 185 * @param success GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
161 * GNUNET_NO if content was already there 186 * GNUNET_NO if content was already there
162 * GNUNET_YES (or other positive value) on success 187 * GNUNET_YES (or other positive value) on success
@@ -167,7 +192,9 @@ add_continuation (void *cls,
167 int32_t success, 192 int32_t success,
168 const char *emsg) 193 const char *emsg)
169{ 194{
170 add_qe = NULL; 195 struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
196
197 *qe = NULL;
171 if (GNUNET_YES != success) 198 if (GNUNET_YES != success)
172 { 199 {
173 fprintf (stderr, 200 fprintf (stderr,
@@ -176,7 +203,9 @@ add_continuation (void *cls,
176 if (GNUNET_NO != success) 203 if (GNUNET_NO != success)
177 ret = 1; 204 ret = 1;
178 } 205 }
179 if ( (NULL == del_qe) && 206 if ( (NULL == add_qe) &&
207 (NULL == add_qe_uri) &&
208 (NULL == del_qe) &&
180 (NULL == list_it) ) 209 (NULL == list_it) )
181 GNUNET_SCHEDULER_shutdown (); 210 GNUNET_SCHEDULER_shutdown ();
182} 211}
@@ -203,6 +232,7 @@ del_continuation (void *cls,
203 _("Deleting record failed: %s\n"), 232 _("Deleting record failed: %s\n"),
204 emsg); 233 emsg);
205 if ( (NULL == add_qe) && 234 if ( (NULL == add_qe) &&
235 (NULL == add_qe_uri) &&
206 (NULL == list_it) ) 236 (NULL == list_it) )
207 GNUNET_SCHEDULER_shutdown (); 237 GNUNET_SCHEDULER_shutdown ();
208} 238}
@@ -244,6 +274,7 @@ display_record (void *cls,
244 { 274 {
245 list_it = NULL; 275 list_it = NULL;
246 if ( (NULL == del_qe) && 276 if ( (NULL == del_qe) &&
277 (NULL == add_qe_uri) &&
247 (NULL == add_qe) ) 278 (NULL == add_qe) )
248 GNUNET_SCHEDULER_shutdown (); 279 GNUNET_SCHEDULER_shutdown ();
249 return; 280 return;
@@ -475,7 +506,7 @@ run (void *cls, char *const *args, const char *cfgfile,
475 name, 506 name,
476 &rd, 507 &rd,
477 &add_continuation, 508 &add_continuation,
478 NULL); 509 &add_qe);
479 } 510 }
480 if (del) 511 if (del)
481 { 512 {
@@ -552,12 +583,12 @@ run (void *cls, char *const *args, const char *cfgfile,
552 if (1 != nonauthority) 583 if (1 != nonauthority)
553 rd.flags |= GNUNET_NAMESTORE_RF_AUTHORITY; 584 rd.flags |= GNUNET_NAMESTORE_RF_AUTHORITY;
554 585
555 add_qe = GNUNET_NAMESTORE_record_create (ns, 586 add_qe_uri = GNUNET_NAMESTORE_record_create (ns,
556 zone_pkey, 587 zone_pkey,
557 name, 588 name,
558 &rd, 589 &rd,
559 &add_continuation, 590 &add_continuation,
560 NULL); 591 &add_qe_uri);
561 } 592 }
562 GNUNET_free_non_null (data); 593 GNUNET_free_non_null (data);
563} 594}