gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3328 - in GNUnet: . src/applications/bootstrap_http src/ap


From: grothoff
Subject: [GNUnet-SVN] r3328 - in GNUnet: . src/applications/bootstrap_http src/applications/session
Date: Sat, 26 Aug 2006 21:49:13 -0700 (PDT)

Author: grothoff
Date: 2006-08-26 21:49:09 -0700 (Sat, 26 Aug 2006)
New Revision: 3328

Added:
   GNUnet/src/applications/session/check.conf
Modified:
   GNUnet/src/applications/bootstrap_http/http.c
   GNUnet/src/applications/session/Makefile.am
   GNUnet/src/applications/session/peer1.conf
   GNUnet/src/applications/session/peer2.conf
   GNUnet/src/applications/session/sessiontest.c
   GNUnet/todo
Log:
making session test compile

Modified: GNUnet/src/applications/bootstrap_http/http.c
===================================================================
--- GNUnet/src/applications/bootstrap_http/http.c       2006-08-27 04:32:06 UTC 
(rev 3327)
+++ GNUnet/src/applications/bootstrap_http/http.c       2006-08-27 04:49:09 UTC 
(rev 3328)
@@ -130,14 +130,16 @@
   bctx.targ = targ;
   bctx.buf = NULL;
   bctx.bsize = 0;
+  url = NULL;
   if (0 != GC_get_configuration_value_string(coreAPI->cfg,
                                             "GNUNETD",
                                             "HOSTLISTURL",
-                                            NULL,
+                                            "",
                                             &url)) {
     GE_LOG(ectx,
           GE_WARNING | GE_BULK | GE_USER,
           _("No hostlist URL specified in configuration, will not 
bootstrap.\n"));
+    FREE(url);
     return;
   }  
   bctx.url = url;

Modified: GNUnet/src/applications/session/Makefile.am
===================================================================
--- GNUnet/src/applications/session/Makefile.am 2006-08-27 04:32:06 UTC (rev 
3327)
+++ GNUnet/src/applications/session/Makefile.am 2006-08-27 04:49:09 UTC (rev 
3328)
@@ -24,9 +24,12 @@
   sessiontest.c 
 sessiontest_LDADD = \
   $(top_builddir)/src/applications/stats/libgnunetstats_api.la \
+  $(top_builddir)/src/util/config_impl/libgnunetutil_config.la  \
+  $(top_builddir)/src/util/network_client/libgnunetutil_network_client.la  \
   $(top_builddir)/src/util/libgnunetutil.la 
 
 EXTRA_DIST = \
+  check.conf \
   peer1.conf \
   peer2.conf \
   peer1/.hostkey \

Added: GNUnet/src/applications/session/check.conf
===================================================================
--- GNUnet/src/applications/session/check.conf  2006-08-27 04:32:06 UTC (rev 
3327)
+++ GNUnet/src/applications/session/check.conf  2006-08-27 04:49:09 UTC (rev 
3328)
@@ -0,0 +1,12 @@
+# General settings
+[GNUNET]
+GNUNET_HOME = "/tmp/gnunet-session-test-driver"
+LOGLEVEL = "WARNING"
+LOGFILE = ""
+PROCESS-PRIORITY = "NORMAL"
+
+# Network options for the clients
+[NETWORK]
+CLIENT-PORT = 2087
+HOST = "localhost"
+

Modified: GNUnet/src/applications/session/peer1.conf
===================================================================
--- GNUnet/src/applications/session/peer1.conf  2006-08-27 04:32:06 UTC (rev 
3327)
+++ GNUnet/src/applications/session/peer1.conf  2006-08-27 04:49:09 UTC (rev 
3328)
@@ -33,27 +33,4 @@
 PORT = 2086
 # BLACKLIST = 
 
-[UDP]
-PORT = 2086
-# BLACKLIST = 
-MTU = 1472
 
-[UDP6]
-# Default port is 2088 and MTU is 1452.
-PORT = 2088
-# BLACKLIST = 
-MTU = 1452
-
-[TCP6]
-
-# Default port is 2088 and MTU is 1440.
-PORT = 2088
-# BLACKLIST = 
-MTU = 1440
-
-[HTTP]
-# Default port is 1080 and MTU is 1400.
-PORT = 1080
-# BLACKLIST =
-
-

Modified: GNUnet/src/applications/session/peer2.conf
===================================================================
--- GNUnet/src/applications/session/peer2.conf  2006-08-27 04:32:06 UTC (rev 
3327)
+++ GNUnet/src/applications/session/peer2.conf  2006-08-27 04:49:09 UTC (rev 
3328)
@@ -33,27 +33,6 @@
 PORT = 12086
 # BLACKLIST = 
 
-[UDP]
-PORT = 12086
-# BLACKLIST = 
-MTU = 1472
 
-[UDP6]
-# Default port is 2088 and MTU is 1452.
-PORT = 12088
-# BLACKLIST = 
-MTU = 1452
 
-[TCP6]
 
-# Default port is 2088 and MTU is 1440.
-PORT = 12088
-# BLACKLIST = 
-MTU = 1440
-
-[HTTP]
-# Default port is 1080 and MTU is 1400.
-PORT = 11080
-# BLACKLIST =
-
-

Modified: GNUnet/src/applications/session/sessiontest.c
===================================================================
--- GNUnet/src/applications/session/sessiontest.c       2006-08-27 04:32:06 UTC 
(rev 3327)
+++ GNUnet/src/applications/session/sessiontest.c       2006-08-27 04:49:09 UTC 
(rev 3328)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2005 Christian Grothoff (and other contributing authors)
+     (C) 2005, 2006 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -26,28 +26,22 @@
 
 #include "platform.h"
 #include "gnunet_protocols.h"
+#include "gnunet_util.h"
+#include "gnunet_util_config_impl.h"
+#include "gnunet_util_network_client.h"
 #include "gnunet_stats_lib.h"
 
-static int parseOptions(int argc,
-                       char ** argv) {
-  FREENONNULL(setConfigurationString("GNUNETD",
-                                    "LOGFILE",
-                                    NULL));
-  return OK;
-}
+static int ok;
 
-/**
- * Identity of peer 2 (hardwired).
- */
-static PeerIdentity peer2;
-
 static int waitForConnect(const char * name,
                          unsigned long long value,
                          void * cls) {
   if ( (value > 0) &&
        (0 == strcmp(_("# of connected peers"),
-                   name)) )
+                   name)) ) {
+    ok = 1;
     return SYSERR;
+  }
   return OK;
 }
 
@@ -64,56 +58,53 @@
   int ret;
   struct ClientServerConnection * sock;
   int left;
+  struct GC_Configuration * cfg;
 
-  GE_ASSERT(ectx, OK ==
-               enc2hash("BV3AS3KMIIBVIFCGEG907N6NTDTH26B7T6FODUSLSGK"
-                        "5B2Q58IEU1VF5FTR838449CSHVBOAHLDVQAOA33O77F"
-                        "OPDA8F1VIKESLSNBO",
-                        &peer2.hashPubKey));
-  if (OK != initUtil(argc,
-                    argv,
-                    &parseOptions))
-    return -1;
-  FREENONNULL(setConfigurationString("GNUNET",
-                                    "GNUNETD-CONFIG",
-                                    "peer1.conf"));
-  daemon1 = startGNUnetDaemon(NO);
-  FREENONNULL(setConfigurationString("GNUNET",
-                                    "GNUNETD-CONFIG",
-                                    "peer2.conf"));
-  daemon2 = startGNUnetDaemon(NO);
+  cfg = GC_create_C_impl();
+  if (-1 == GC_parse_configuration(cfg,
+                                  "check.conf")) {
+    GC_free(cfg);
+    return -1;  
+  }
+  daemon1  = os_daemon_start(NULL,
+                            cfg,
+                            "peer1.conf",
+                            NO);
+  daemon2 = os_daemon_start(NULL,
+                           cfg,
+                           "peer2.conf",
+                           NO);
   /* in case existing hellos have expired */
   PTHREAD_SLEEP(30 * cronSECONDS);
   system("cp peer1/data/hosts/* peer2/data/hosts/");
   system("cp peer2/data/hosts/* peer1/data/hosts/");
+  ret = 0;
   if (daemon1 != -1) {
-    if (! termProcess(daemon1))
-      DIE_STRERROR("kill");
-    GE_ASSERT(ectx, OK == waitForGNUnetDaemonTermination(daemon1));
+    if (os_daemon_stop(NULL, daemon1) != YES)
+      ret = 1;
   }
   if (daemon2 != -1) {
-    if (! termProcess(daemon2))
-      DIE_STRERROR("kill");
-    GE_ASSERT(ectx, OK == waitForGNUnetDaemonTermination(daemon2));
+    if (os_daemon_stop(NULL, daemon2) != YES)
+      ret = 1;
   }
-
-  /* re-start, this time we're sure up-to-date hellos are available */
-  FREENONNULL(setConfigurationString("GNUNET",
-                                    "GNUNETD-CONFIG",
-                                    "peer1.conf"));
-  daemon1 = startGNUnetDaemon(NO);
-  FREENONNULL(setConfigurationString("GNUNET",
-                                    "GNUNETD-CONFIG",
-                                    "peer2.conf"));
-  daemon2 = startGNUnetDaemon(NO);
+  if (ret != 0)
+    return 1;
+  daemon1  = os_daemon_start(NULL,
+                            cfg,
+                            "peer1.conf",
+                            NO);
+  daemon2 = os_daemon_start(NULL,
+                           cfg,
+                           "peer2.conf",
+                           NO);
   PTHREAD_SLEEP(5 * cronSECONDS);
 
-
   ret = 0;
   left = 5;
   /* wait for connection or abort with error */
   do {
-    sock = getClientSocket();
+    sock = client_connection_create(NULL,
+                                   cfg);
     if (sock == NULL) {
       printf(_("Waiting for gnunetd to start (%u iterations left)...\n"),
             left);
@@ -127,7 +118,8 @@
   } while (sock == NULL);
 
   left = 30; /* how many iterations should we wait? */
-  while (OK == requestStatistics(sock,
+  while (OK == requestStatistics(NULL,
+                                sock,
                                 &waitForConnect,
                                 NULL)) {
     printf(_("Waiting for peers to connect (%u iterations left)...\n"),
@@ -141,16 +133,17 @@
   }
   connection_destroy(sock);
   if (daemon1 != -1) {
-    if (! termProcess(daemon1))
-      DIE_STRERROR("kill");
-    GE_ASSERT(ectx, OK == waitForGNUnetDaemonTermination(daemon1));
+    if (os_daemon_stop(NULL, daemon1) != YES)
+      ret = 1;
   }
   if (daemon2 != -1) {
-    if (! termProcess(daemon2))
-      DIE_STRERROR("kill");
-    GE_ASSERT(ectx, OK == waitForGNUnetDaemonTermination(daemon2));
+    if (os_daemon_stop(NULL, daemon2) != YES)
+      ret = 1;
   }
-  doneUtil();
+  if (ok == 0)
+    ret = 1;
+
+  GC_free(cfg);
   return ret;
 }
 

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-08-27 04:32:06 UTC (rev 3327)
+++ GNUnet/todo 2006-08-27 04:49:09 UTC (rev 3328)
@@ -20,7 +20,7 @@
     + use new loggers in for CS error reporting
   * make testcases compile & pass again:
     + util/network_client/ 
-    + session
+    + session -- compiles, but fails!
     + gap
     + fs/ecrs
     + fs/lib





reply via email to

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