diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-05-03 11:35:36 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-05-03 11:35:36 +0000 |
commit | 5fed535a3e841e0c317506db8a698b65a4b4cf28 (patch) | |
tree | 4e0f1332ac528110a93644996efd48a15c44d245 /src/peerinfo/peerinfo_api.c | |
parent | ed03501d4f67d8acef116c6609393cca28923cd0 (diff) | |
download | gnunet-5fed535a3e841e0c317506db8a698b65a4b4cf28.tar.gz gnunet-5fed535a3e841e0c317506db8a698b65a4b4cf28.zip |
-fix
Diffstat (limited to 'src/peerinfo/peerinfo_api.c')
-rw-r--r-- | src/peerinfo/peerinfo_api.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index f70b8fde1..5b79a17e5 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -52,6 +52,11 @@ struct GNUNET_PEERINFO_AddContext | |||
52 | struct GNUNET_PEERINFO_AddContext *prev; | 52 | struct GNUNET_PEERINFO_AddContext *prev; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Handle to the PEERINFO service. | ||
56 | */ | ||
57 | struct GNUNET_PEERINFO_Handle *h; | ||
58 | |||
59 | /** | ||
55 | * Function to call after request has been transmitted, or NULL. | 60 | * Function to call after request has been transmitted, or NULL. |
56 | */ | 61 | */ |
57 | GNUNET_PEERINFO_Continuation cont; | 62 | GNUNET_PEERINFO_Continuation cont; |
@@ -420,17 +425,34 @@ GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, | |||
420 | "Adding peer `%s' to PEERINFO database (%u bytes of `%s')\n", | 425 | "Adding peer `%s' to PEERINFO database (%u bytes of `%s')\n", |
421 | GNUNET_i2s (&peer), hs, "HELLO"); | 426 | GNUNET_i2s (&peer), hs, "HELLO"); |
422 | ac = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) + hs); | 427 | ac = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) + hs); |
428 | ac->h = h; | ||
423 | ac->size = hs; | 429 | ac->size = hs; |
424 | ac->cont = cont; | 430 | ac->cont = cont; |
425 | ac->cont_cls = cont_cls; | 431 | ac->cont_cls = cont_cls; |
426 | memcpy (&ac[1], hello, hs); | 432 | memcpy (&ac[1], hello, hs); |
427 | GNUNET_CONTAINER_DLL_insert_after (h->ac_head, h->ac_tail, h->ac_tail, ac); | 433 | GNUNET_CONTAINER_DLL_insert_tail (h->ac_head, h->ac_tail, ac); |
428 | trigger_transmit (h); | 434 | trigger_transmit (h); |
429 | return ac; | 435 | return ac; |
430 | } | 436 | } |
431 | 437 | ||
432 | 438 | ||
433 | /** | 439 | /** |
440 | * Cancel pending 'add' operation. Must only be called before | ||
441 | * either 'cont' or 'GNUNET_PEERINFO_disconnect' are invoked. | ||
442 | * | ||
443 | * @param ac handle for the add operation to cancel | ||
444 | */ | ||
445 | void | ||
446 | GNUNET_PEERINFO_add_peer_cancel (struct GNUNET_PEERINFO_AddContext *ac) | ||
447 | { | ||
448 | struct GNUNET_PEERINFO_Handle *h = ac->h; | ||
449 | |||
450 | GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac); | ||
451 | GNUNET_free (ac); | ||
452 | } | ||
453 | |||
454 | |||
455 | /** | ||
434 | * Type of a function to call when we receive a message from the | 456 | * Type of a function to call when we receive a message from the |
435 | * service. Call the iterator with the result and (if applicable) | 457 | * service. Call the iterator with the result and (if applicable) |
436 | * continue to receive more messages or trigger processing the next | 458 | * continue to receive more messages or trigger processing the next |