gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r21242 - in gnunet/src: . peerinfo-tool


From: gnunet
Subject: [GNUnet-SVN] r21242 - in gnunet/src: . peerinfo-tool
Date: Thu, 3 May 2012 13:33:00 +0200

Author: grothoff
Date: 2012-05-03 13:33:00 +0200 (Thu, 03 May 2012)
New Revision: 21242

Modified:
   gnunet/src/Makefile.am
   gnunet/src/peerinfo-tool/gnunet-peerinfo.c
Log:
-applying fix based on fixed #2210

Modified: gnunet/src/Makefile.am
===================================================================
--- gnunet/src/Makefile.am      2012-05-03 11:27:14 UTC (rev 21241)
+++ gnunet/src/Makefile.am      2012-05-03 11:33:00 UTC (rev 21242)
@@ -28,7 +28,6 @@
   block \
   statistics \
   arm \
-  lockmanager \
   peerinfo \
   $(MYSQL_DIR) \
   $(POSTGRES_DIR) \

Modified: gnunet/src/peerinfo-tool/gnunet-peerinfo.c
===================================================================
--- gnunet/src/peerinfo-tool/gnunet-peerinfo.c  2012-05-03 11:27:14 UTC (rev 
21241)
+++ gnunet/src/peerinfo-tool/gnunet-peerinfo.c  2012-05-03 11:33:00 UTC (rev 
21242)
@@ -215,7 +215,12 @@
  */
 static struct PrintContext *pc_tail;
 
+/**
+ * Handle to current 'GNUNET_PEERINFO_add_peer' operation.
+ */
+static struct GNUNET_PEERINFO_AddContext *ac;
 
+
 /**
  * Main state machine that goes over all options and
  * runs the next requested function.
@@ -665,6 +670,25 @@
 
 
 /**
+ * Continuation called from 'GNUNET_PEERINFO_add_peer'
+ *
+ * @param cls closure, NULL
+ * @param emsg error message, NULL on success
+ */
+static void
+add_continuation (void *cls,
+                 const char *emsg)
+{
+  ai = NULL;
+  if (NULL != emsg)
+    fprintf (stderr,
+            _("Failure adding HELLO: %s\n"),
+            emsg);
+  tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
+}
+
+
+/**
  * Parse the PUT URI given at the command line and add it to our peerinfo 
  * database.
  *
@@ -698,16 +722,16 @@
   if (NULL != hello)
   {
     /* WARNING: this adds the address from URI WITHOUT verification! */
-    if (GNUNET_OK == ctx.ret)
-      GNUNET_PEERINFO_add_peer (peerinfo, hello, NULL, NULL);
+    if (GNUNET_OK == ctx.ret)    
+      ac = GNUNET_PEERINFO_add_peer (peerinfo, hello, NULL, NULL);
+    else
+      tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
     GNUNET_free (hello);
   }
 
   /* wait 1s to give peerinfo operation a chance to succeed */
   /* FIXME: current peerinfo API sucks to require this; not to mention
      that we get no feedback to determine if the operation actually succeeded 
*/
-  tt = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                    &state_machine, NULL);
   return ctx.ret;
 }
 
@@ -730,6 +754,11 @@
   struct AddressRecord *ar;
   unsigned int i;
 
+  if (NULL != ac)
+  {
+    GNUNET_PEERINFO_add_peer_cancel (ac);
+    ac = NULL;
+  }
   if (GNUNET_SCHEDULER_NO_TASK != tt)
   {
     GNUNET_SCHEDULER_cancel (tt);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]