gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r4850 - GNUnet/src/applications/testing


From: gnunet
Subject: [GNUnet-SVN] r4850 - GNUnet/src/applications/testing
Date: Mon, 28 May 2007 22:24:49 -0600 (MDT)

Author: grothoff
Date: 2007-05-28 22:24:49 -0600 (Mon, 28 May 2007)
New Revision: 4850

Modified:
   GNUnet/src/applications/testing/testing.c
Log:
wait

Modified: GNUnet/src/applications/testing/testing.c
===================================================================
--- GNUnet/src/applications/testing/testing.c   2007-05-29 03:22:17 UTC (rev 
4849)
+++ GNUnet/src/applications/testing/testing.c   2007-05-29 04:24:49 UTC (rev 
4850)
@@ -82,6 +82,7 @@
   char host[128];
   struct ClientServerConnection * sock;
   P2P_hello_MESSAGE * hello;
+  int round;
 
   fprintf(stderr,
          "Starting peer on port %u\n",
@@ -197,22 +198,30 @@
   }
   *configFile = dpath;
   dpath = NULL;
-  sock = client_connection_create(NULL,
-                                 cfg);
-  ret = gnunet_identity_get_self(sock,
-                                &hello);
-  if (ret == OK) {
-    hash(&hello->publicKey,
-        sizeof(PublicKey),
-        &peer->hashPubKey);
-    FREE(hello);
-  } else {
+  round = 0;
+  ret = SYSERR;
+  while ( (round++ < 10) &&
+         (ret == SYSERR) ) {
+    sock = client_connection_create(NULL,
+                                   cfg);
+    ret = gnunet_identity_get_self(sock,
+                                  &hello);
+    if (ret == OK) {
+      hash(&hello->publicKey,
+          sizeof(PublicKey),
+          &peer->hashPubKey);
+      FREE(hello);
+    } else {
+      PTHREAD_SLEEP(2 * cronSECONDS);
+    }
+    connection_destroy(sock);
+  }
+  GC_free(cfg);
+  if (ret == SYSERR)
     fprintf(stderr,
            "Failed to obtain daemon's identity (is a transport loaded?)!\n");
-  }
-  connection_destroy(sock);
-  GC_free(cfg);
 
+
   return ret;
 }
 





reply via email to

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