[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21243 - in gnunet/src: peerinfo peerinfo-tool
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21243 - in gnunet/src: peerinfo peerinfo-tool |
Date: |
Thu, 3 May 2012 13:35:36 +0200 |
Author: grothoff
Date: 2012-05-03 13:35:36 +0200 (Thu, 03 May 2012)
New Revision: 21243
Modified:
gnunet/src/peerinfo-tool/gnunet-peerinfo.c
gnunet/src/peerinfo/peerinfo_api.c
Log:
-fix
Modified: gnunet/src/peerinfo/peerinfo_api.c
===================================================================
--- gnunet/src/peerinfo/peerinfo_api.c 2012-05-03 11:33:00 UTC (rev 21242)
+++ gnunet/src/peerinfo/peerinfo_api.c 2012-05-03 11:35:36 UTC (rev 21243)
@@ -52,6 +52,11 @@
struct GNUNET_PEERINFO_AddContext *prev;
/**
+ * Handle to the PEERINFO service.
+ */
+ struct GNUNET_PEERINFO_Handle *h;
+
+ /**
* Function to call after request has been transmitted, or NULL.
*/
GNUNET_PEERINFO_Continuation cont;
@@ -420,17 +425,34 @@
"Adding peer `%s' to PEERINFO database (%u bytes of `%s')\n",
GNUNET_i2s (&peer), hs, "HELLO");
ac = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) + hs);
+ ac->h = h;
ac->size = hs;
ac->cont = cont;
ac->cont_cls = cont_cls;
memcpy (&ac[1], hello, hs);
- GNUNET_CONTAINER_DLL_insert_after (h->ac_head, h->ac_tail, h->ac_tail, ac);
+ GNUNET_CONTAINER_DLL_insert_tail (h->ac_head, h->ac_tail, ac);
trigger_transmit (h);
return ac;
}
/**
+ * Cancel pending 'add' operation. Must only be called before
+ * either 'cont' or 'GNUNET_PEERINFO_disconnect' are invoked.
+ *
+ * @param ac handle for the add operation to cancel
+ */
+void
+GNUNET_PEERINFO_add_peer_cancel (struct GNUNET_PEERINFO_AddContext *ac)
+{
+ struct GNUNET_PEERINFO_Handle *h = ac->h;
+
+ GNUNET_CONTAINER_DLL_remove (h->ac_head, h->ac_tail, ac);
+ GNUNET_free (ac);
+}
+
+
+/**
* Type of a function to call when we receive a message from the
* service. Call the iterator with the result and (if applicable)
* continue to receive more messages or trigger processing the next
Modified: gnunet/src/peerinfo-tool/gnunet-peerinfo.c
===================================================================
--- gnunet/src/peerinfo-tool/gnunet-peerinfo.c 2012-05-03 11:33:00 UTC (rev
21242)
+++ gnunet/src/peerinfo-tool/gnunet-peerinfo.c 2012-05-03 11:35:36 UTC (rev
21243)
@@ -679,7 +679,7 @@
add_continuation (void *cls,
const char *emsg)
{
- ai = NULL;
+ ac = NULL;
if (NULL != emsg)
fprintf (stderr,
_("Failure adding HELLO: %s\n"),
@@ -723,7 +723,7 @@
{
/* WARNING: this adds the address from URI WITHOUT verification! */
if (GNUNET_OK == ctx.ret)
- ac = GNUNET_PEERINFO_add_peer (peerinfo, hello, NULL, NULL);
+ ac = GNUNET_PEERINFO_add_peer (peerinfo, hello, &add_continuation, NULL);
else
tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
GNUNET_free (hello);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21243 - in gnunet/src: peerinfo peerinfo-tool,
gnunet <=