diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-07 16:06:14 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-07 16:06:14 +0000 |
commit | 78d1ac5fceb9dfb4935a7c266416c1342de08959 (patch) | |
tree | 9dcb04c73c1390b00363521c91424046e56cd918 /src/namestore/namestore_api.c | |
parent | 375e1b742172911b41b1dd04c8c4efdb65caf408 (diff) | |
download | gnunet-78d1ac5fceb9dfb4935a7c266416c1342de08959.tar.gz gnunet-78d1ac5fceb9dfb4935a7c266416c1342de08959.zip |
- fix remomve callboack order
Diffstat (limited to 'src/namestore/namestore_api.c')
-rw-r--r-- | src/namestore/namestore_api.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index d92463bbd..ae90e7441 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -220,6 +220,11 @@ handle_lookup_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
220 | "LOOKUP_NAME_RESPONSE"); | 220 | "LOOKUP_NAME_RESPONSE"); |
221 | 221 | ||
222 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; | 222 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; |
223 | |||
224 | /* Operation done, remove */ | ||
225 | GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe); | ||
226 | |||
227 | |||
223 | char *name; | 228 | char *name; |
224 | char * rd_tmp; | 229 | char * rd_tmp; |
225 | 230 | ||
@@ -276,9 +281,6 @@ handle_lookup_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
276 | { | 281 | { |
277 | qe->proc (qe->proc_cls, public_key_tmp, expire, name, rd_count, (rd_count > 0) ? rd : NULL, signature); | 282 | qe->proc (qe->proc_cls, public_key_tmp, expire, name, rd_count, (rd_count > 0) ? rd : NULL, signature); |
278 | } | 283 | } |
279 | |||
280 | /* Operation done, remove */ | ||
281 | GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe); | ||
282 | GNUNET_free (qe); | 284 | GNUNET_free (qe); |
283 | } | 285 | } |
284 | 286 | ||
@@ -290,7 +292,11 @@ handle_record_put_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
290 | { | 292 | { |
291 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n", | 293 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n", |
292 | "RECORD_PUT_RESPONSE"); | 294 | "RECORD_PUT_RESPONSE"); |
295 | |||
293 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; | 296 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; |
297 | /* Operation done, remove */ | ||
298 | GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe); | ||
299 | |||
294 | int res = ntohl (msg->op_result); | 300 | int res = ntohl (msg->op_result); |
295 | 301 | ||
296 | if (res == GNUNET_OK) | 302 | if (res == GNUNET_OK) |
@@ -314,9 +320,6 @@ handle_record_put_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
314 | return; | 320 | return; |
315 | } | 321 | } |
316 | 322 | ||
317 | /* Operation done, remove */ | ||
318 | GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe); | ||
319 | |||
320 | GNUNET_free (qe); | 323 | GNUNET_free (qe); |
321 | } | 324 | } |
322 | 325 | ||
@@ -328,9 +331,12 @@ handle_record_create_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
328 | { | 331 | { |
329 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n", | 332 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' \n", |
330 | "RECORD_CREATE_RESPONSE"); | 333 | "RECORD_CREATE_RESPONSE"); |
334 | |||
331 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; | 335 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; |
332 | int res = ntohl (msg->op_result); | 336 | /* Operation done, remove */ |
337 | GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe); | ||
333 | 338 | ||
339 | int res = ntohl (msg->op_result); | ||
334 | if (res == GNUNET_YES) | 340 | if (res == GNUNET_YES) |
335 | { | 341 | { |
336 | if (qe->cont != NULL) | 342 | if (qe->cont != NULL) |
@@ -354,9 +360,6 @@ handle_record_create_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
354 | } | 360 | } |
355 | } | 361 | } |
356 | 362 | ||
357 | /* Operation done, remove */ | ||
358 | GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe); | ||
359 | |||
360 | GNUNET_free (qe); | 363 | GNUNET_free (qe); |
361 | } | 364 | } |
362 | 365 | ||
@@ -370,8 +373,11 @@ handle_record_remove_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
370 | "RECORD_REMOVE_RESPONSE"); | 373 | "RECORD_REMOVE_RESPONSE"); |
371 | 374 | ||
372 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; | 375 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; |
373 | int res = ntohl (msg->op_result); | 376 | /* Operation done, remove */ |
377 | GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe); | ||
378 | |||
374 | 379 | ||
380 | int res = ntohl (msg->op_result); | ||
375 | /** | 381 | /** |
376 | * result: | 382 | * result: |
377 | * 0 : successful | 383 | * 0 : successful |
@@ -420,9 +426,6 @@ handle_record_remove_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
420 | break; | 426 | break; |
421 | } | 427 | } |
422 | 428 | ||
423 | /* Operation done, remove */ | ||
424 | GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe); | ||
425 | |||
426 | GNUNET_free (qe); | 429 | GNUNET_free (qe); |
427 | } | 430 | } |
428 | 431 | ||
@@ -435,6 +438,9 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
435 | "ZONE_TO_NAME_RESPONSE"); | 438 | "ZONE_TO_NAME_RESPONSE"); |
436 | 439 | ||
437 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; | 440 | struct GNUNET_NAMESTORE_Handle *h = qe->nsh; |
441 | /* Operation done, remove */ | ||
442 | GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe); | ||
443 | |||
438 | int res = ntohs (msg->res); | 444 | int res = ntohs (msg->res); |
439 | 445 | ||
440 | struct GNUNET_TIME_Absolute expire; | 446 | struct GNUNET_TIME_Absolute expire; |
@@ -478,8 +484,6 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
478 | else | 484 | else |
479 | GNUNET_break_op (0); | 485 | GNUNET_break_op (0); |
480 | 486 | ||
481 | /* Operation done, remove */ | ||
482 | GNUNET_CONTAINER_DLL_remove(h->op_head, h->op_tail, qe); | ||
483 | GNUNET_free (qe); | 487 | GNUNET_free (qe); |
484 | } | 488 | } |
485 | 489 | ||
@@ -582,10 +586,11 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze, | |||
582 | { | 586 | { |
583 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone iteration is completed!\n"); | 587 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone iteration is completed!\n"); |
584 | 588 | ||
589 | GNUNET_CONTAINER_DLL_remove(ze->h->z_head, ze->h->z_tail, ze); | ||
590 | |||
585 | if (ze->proc != NULL) | 591 | if (ze->proc != NULL) |
586 | ze->proc(ze->proc_cls, NULL, GNUNET_TIME_absolute_get_zero (), NULL , 0, NULL, NULL); | 592 | ze->proc(ze->proc_cls, NULL, GNUNET_TIME_absolute_get_zero (), NULL , 0, NULL, NULL); |
587 | 593 | ||
588 | GNUNET_CONTAINER_DLL_remove(ze->h->z_head, ze->h->z_tail, ze); | ||
589 | GNUNET_free (ze); | 594 | GNUNET_free (ze); |
590 | return; | 595 | return; |
591 | } | 596 | } |