[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3378 - in GNUnet: . src/applications/session src/applicati
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3378 - in GNUnet: . src/applications/session src/applications/tbench src/util/os |
Date: |
Thu, 7 Sep 2006 20:34:37 -0700 (PDT) |
Author: grothoff
Date: 2006-09-07 20:34:31 -0700 (Thu, 07 Sep 2006)
New Revision: 3378
Modified:
GNUnet/ChangeLog
GNUnet/src/applications/session/sessiontest.c
GNUnet/src/applications/tbench/Makefile.am
GNUnet/src/applications/tbench/tbenchtest.c
GNUnet/src/applications/tbench/tbenchtest_udp.c
GNUnet/src/util/os/dso.c
GNUnet/src/util/os/installpath.c
GNUnet/todo
Log:
making tbench test compile
Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog 2006-09-07 13:15:47 UTC (rev 3377)
+++ GNUnet/ChangeLog 2006-09-08 03:34:31 UTC (rev 3378)
@@ -1,3 +1,7 @@
+Tue Sep 5 21:28:25 PDT 2006
+ Switched ncurses interface of gnunet-setup to use
+ external dialog library (new dependency!).
+
Fri Aug 18 00:01:37 PDT 2006
Swiched http bootstrap mechanism to using libcurl
(new dependency!).
Modified: GNUnet/src/applications/session/sessiontest.c
===================================================================
--- GNUnet/src/applications/session/sessiontest.c 2006-09-07 13:15:47 UTC
(rev 3377)
+++ GNUnet/src/applications/session/sessiontest.c 2006-09-08 03:34:31 UTC
(rev 3378)
@@ -127,6 +127,7 @@
connection_destroy(sock);
} else {
printf("Could not establish connection with peer.\n");
+ ret = 1;
}
#if START_PEERS
if (daemon1 != -1) {
Modified: GNUnet/src/applications/tbench/Makefile.am
===================================================================
--- GNUnet/src/applications/tbench/Makefile.am 2006-09-07 13:15:47 UTC (rev
3377)
+++ GNUnet/src/applications/tbench/Makefile.am 2006-09-08 03:34:31 UTC (rev
3378)
@@ -57,6 +57,7 @@
$(top_builddir)/src/util/libgnunetutil.la
EXTRA_DIST = \
+ check.conf \
peer1.conf \
peer2.conf \
peer1/.hostkey \
Modified: GNUnet/src/applications/tbench/tbenchtest.c
===================================================================
--- GNUnet/src/applications/tbench/tbenchtest.c 2006-09-07 13:15:47 UTC (rev
3377)
+++ GNUnet/src/applications/tbench/tbenchtest.c 2006-09-08 03:34:31 UTC (rev
3378)
@@ -27,16 +27,10 @@
#include "platform.h"
#include "gnunet_protocols.h"
#include "gnunet_stats_lib.h"
+#include "gnunet_util_config_impl.h"
+#include "gnunet_util_network_client.h"
#include "tbench.h"
-static int parseOptions(int argc,
- char ** argv) {
- FREENONNULL(setConfigurationString("GNUNETD",
- "LOGFILE",
- NULL));
- return OK;
-}
-
/**
* Identity of peer 2.
*/
@@ -75,7 +69,7 @@
ret = 0;
buffer = NULL;
- if (OK == connection_read(sock, (CS_MESSAGE_HEADER**)&buffer)) {
+ if (OK == connection_read(sock, (MESSAGE_HEADER**)&buffer)) {
if ((float)buffer->mean_loss <= 0){
messagesPercentLoss = 0.0;
} else {
@@ -116,7 +110,8 @@
ret = 0;
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"),
@@ -139,99 +134,108 @@
* @return 0: ok, -1: error
*/
int main(int argc, char ** argv) {
+#if START_PEERS
pid_t daemon1;
pid_t daemon2;
+#endif
+ int i;
+ int ok;
int ret;
+ struct ClientServerConnection * sock;
int left;
- struct ClientServerConnection * sock;
- int i;
+ 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;
+ }
+#if START_PEERS
+ daemon1 = os_daemon_start(NULL,
+ cfg,
+ "peer1.conf",
+ NO);
+ daemon2 = os_daemon_start(NULL,
+ cfg,
+ "peer2.conf",
+ NO);
+#endif
/* in case existing hellos have expired */
- sleep(5);
+ PTHREAD_SLEEP(30 * cronSECONDS);
system("cp peer1/data/hosts/* peer2/data/hosts/");
system("cp peer2/data/hosts/* peer1/data/hosts/");
+ ret = 0;
+#if START_PEERS
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);
- PTHREAD_SLEEP(5 * cronSECONDS);
- sleep(5);
-
- ret = 0;
- left = 5;
- /* wait for connection or abort with error */
- do {
- sock = getClientSocket();
- if (sock == NULL) {
- printf(_("Waiting for gnunetd to start (%u iterations left)...\n"),
+ if (ret != 0)
+ return 1;
+ daemon1 = os_daemon_start(NULL,
+ cfg,
+ "peer1.conf",
+ NO);
+ daemon2 = os_daemon_start(NULL,
+ cfg,
+ "peer2.conf",
+ NO);
+#endif
+ if (OK == connection_wait_for_running(NULL,
+ cfg,
+ 30 * cronSECONDS)) {
+ sock = client_connection_create(NULL,
+ cfg);
+ left = 30; /* how many iterations should we wait? */
+ while (OK == requestStatistics(NULL,
+ sock,
+ &waitForConnect,
+ NULL)) {
+ printf("Waiting for peers to connect (%u iterations left)...\n",
left);
- sleep(1);
+ sleep(5);
left--;
if (left == 0) {
ret = 1;
break;
}
}
- } while (sock == NULL);
-
- ret = checkConnected(sock);
- printf(_("Running benchmark...\n"));
- /* 'slow' pass: wait for bandwidth negotiation! */
- if (ret == 0)
- ret = test(sock, 64, 100, 4, 50 * cronMILLIS, 1, 30 * cronSECONDS);
- checkConnected(sock);
- /* 'blast' pass: hit bandwidth limits! */
- for (i=8;i<60000;i*=2) {
+ ret = checkConnected(sock);
+ printf(_("Running benchmark...\n"));
+ /* 'slow' pass: wait for bandwidth negotiation! */
if (ret == 0)
- ret = test(sock, i, 1+1024/i, 4, 10 * cronMILLIS, 2, 2 * cronSECONDS);
+ ret = test(sock, 64, 100, 4, 50 * cronMILLIS, 1, 30 * cronSECONDS);
checkConnected(sock);
+ /* 'blast' pass: hit bandwidth limits! */
+ for (i=8;i<60000;i*=2) {
+ if (ret == 0)
+ ret = test(sock, i, 1+1024/i, 4, 10 * cronMILLIS, 2, 2 * cronSECONDS);
+ checkConnected(sock);
+ }
+ ret = test(sock, 32768, 10, 10, 500 * cronMILLIS, 1, 10 * cronSECONDS);
+ connection_destroy(sock);
+ } else {
+ printf("Could not establish connection with peer.\n");
}
- ret = test(sock, 32768, 10, 10, 500 * cronMILLIS, 1, 10 * cronSECONDS);
- connection_destroy(sock);
+#if START_PEERS
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();
+#endif
+ if (ok == 0)
+ ret = 1;
+
+ GC_free(cfg);
return ret;
}
Modified: GNUnet/src/applications/tbench/tbenchtest_udp.c
===================================================================
--- GNUnet/src/applications/tbench/tbenchtest_udp.c 2006-09-07 13:15:47 UTC
(rev 3377)
+++ GNUnet/src/applications/tbench/tbenchtest_udp.c 2006-09-08 03:34:31 UTC
(rev 3378)
@@ -19,7 +19,7 @@
*/
/**
- * @file applications/tbench/tbenchtest_udp.c
+ * @file applications/tbench/tbenchtest.c
* @brief Transport mechanism testing tool
* @author Paul Ruth, Christian Grothoff
*/
@@ -27,16 +27,10 @@
#include "platform.h"
#include "gnunet_protocols.h"
#include "gnunet_stats_lib.h"
+#include "gnunet_util_config_impl.h"
+#include "gnunet_util_network_client.h"
#include "tbench.h"
-static int parseOptions(int argc,
- char ** argv) {
- FREENONNULL(setConfigurationString("GNUNETD",
- "LOGFILE",
- NULL));
- return OK;
-}
-
/**
* Identity of peer 2.
*/
@@ -75,7 +69,7 @@
ret = 0;
buffer = NULL;
- if (OK == connection_read(sock, (CS_MESSAGE_HEADER**)&buffer)) {
+ if (OK == connection_read(sock, (MESSAGE_HEADER**)&buffer)) {
if ((float)buffer->mean_loss <= 0){
messagesPercentLoss = 0.0;
} else {
@@ -116,7 +110,8 @@
ret = 0;
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"),
@@ -139,102 +134,108 @@
* @return 0: ok, -1: error
*/
int main(int argc, char ** argv) {
+#if START_PEERS
pid_t daemon1;
pid_t daemon2;
+#endif
+ int i;
+ int ok;
int ret;
+ struct ClientServerConnection * sock;
int left;
- struct ClientServerConnection * sock;
- int i;
+ struct GC_Configuration * cfg;
- GE_ASSERT(ectx, OK ==
- enc2hash("BV3AS3KMIIBVIFCGEG907N6NTDTH26B7T6FODUSLSGK"
- "5B2Q58IEU1VF5FTR838449CSHVBOAHLDVQAOA33O77F"
- "OPDA8F1VIKESLSNBO",
- &peer2.hashPubKey));
- if (OK != initUtil(argc,
- argv,
- &parseOptions))
- return -1;
-#if 0
- FREENONNULL(setConfigurationString("GNUNET",
- "GNUNETD-CONFIG",
- "peer1udp.conf"));
- daemon1 = startGNUnetDaemon(NO);
- FREENONNULL(setConfigurationString("GNUNET",
- "GNUNETD-CONFIG",
- "peer2udp.conf"));
- daemon2 = startGNUnetDaemon(NO);
+ cfg = GC_create_C_impl();
+ if (-1 == GC_parse_configuration(cfg,
+ "check.conf")) {
+ GC_free(cfg);
+ return -1;
+ }
+#if START_PEERS
+ daemon1 = os_daemon_start(NULL,
+ cfg,
+ "peer1udp.conf",
+ NO);
+ daemon2 = os_daemon_start(NULL,
+ cfg,
+ "peer2udp.conf",
+ NO);
+#endif
/* in case existing hellos have expired */
- sleep(5);
- system("cp peer1-udp/data/hosts/* peer2-udp/data/hosts/");
- system("cp peer2-udp/data/hosts/* peer1-udp/data/hosts/");
+ PTHREAD_SLEEP(30 * cronSECONDS);
+ system("cp peer1/data/hosts/* peer2/data/hosts/");
+ system("cp peer2/data/hosts/* peer1/data/hosts/");
+ ret = 0;
+#if START_PEERS
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;
}
+ if (ret != 0)
+ return 1;
+ daemon1 = os_daemon_start(NULL,
+ cfg,
+ "peer1udp.conf",
+ NO);
+ daemon2 = os_daemon_start(NULL,
+ cfg,
+ "peer2udp.conf",
+ NO);
#endif
-
- /* re-start, this time we're sure up-to-date hellos are available */
- FREENONNULL(setConfigurationString("GNUNET",
- "GNUNETD-CONFIG",
- "peer1udp.conf"));
- daemon1 = startGNUnetDaemon(NO);
- FREENONNULL(setConfigurationString("GNUNET",
- "GNUNETD-CONFIG",
- "peer2udp.conf"));
- daemon2 = startGNUnetDaemon(NO);
- PTHREAD_SLEEP(5 * cronSECONDS);
- sleep(5);
-
- ret = 0;
- left = 5;
- /* wait for connection or abort with error */
- do {
- sock = getClientSocket();
- if (sock == NULL) {
- printf(_("Waiting for gnunetd to start (%u iterations left)...\n"),
+ if (OK == connection_wait_for_running(NULL,
+ cfg,
+ 30 * cronSECONDS)) {
+ sock = client_connection_create(NULL,
+ cfg);
+ left = 30; /* how many iterations should we wait? */
+ while (OK == requestStatistics(NULL,
+ sock,
+ &waitForConnect,
+ NULL)) {
+ printf("Waiting for peers to connect (%u iterations left)...\n",
left);
- sleep(1);
+ sleep(5);
left--;
if (left == 0) {
ret = 1;
break;
}
}
- } while (sock == NULL);
-
- ret = checkConnected(sock);
- printf(_("Running benchmark...\n"));
- /* 'slow' pass: wait for bandwidth negotiation! */
- if (ret == 0)
- ret = test(sock, 64, 100, 4, 50 * cronMILLIS, 1, 30 * cronSECONDS);
- checkConnected(sock);
- /* 'blast' pass: hit bandwidth limits! */
- for (i=8;i<60000;i*=2) {
+ ret = checkConnected(sock);
+ printf(_("Running benchmark...\n"));
+ /* 'slow' pass: wait for bandwidth negotiation! */
if (ret == 0)
- ret = test(sock, i, 1+1024/i, 4, 10 * cronMILLIS, 2, 2 * cronSECONDS);
+ ret = test(sock, 64, 100, 4, 50 * cronMILLIS, 1, 30 * cronSECONDS);
checkConnected(sock);
+ /* 'blast' pass: hit bandwidth limits! */
+ for (i=8;i<60000;i*=2) {
+ if (ret == 0)
+ ret = test(sock, i, 1+1024/i, 4, 10 * cronMILLIS, 2, 2 * cronSECONDS);
+ checkConnected(sock);
+ }
+ ret = test(sock, 32768, 10, 10, 500 * cronMILLIS, 1, 10 * cronSECONDS);
+ connection_destroy(sock);
+ } else {
+ printf("Could not establish connection with peer.\n");
}
- ret = test(sock, 4096, 10, 10, 500 * cronMILLIS, 1, 10 * cronSECONDS);
- ret = test(sock, 32768, 10, 10, 500 * cronMILLIS, 1, 10 * cronSECONDS);
- connection_destroy(sock);
+#if START_PEERS
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();
+#endif
+ if (ok == 0)
+ ret = 1;
+
+ GC_free(cfg);
return ret;
}
Modified: GNUnet/src/util/os/dso.c
===================================================================
--- GNUnet/src/util/os/dso.c 2006-09-07 13:15:47 UTC (rev 3377)
+++ GNUnet/src/util/os/dso.c 2006-09-08 03:34:31 UTC (rev 3378)
@@ -40,7 +40,7 @@
/* using libtool, needs init! */
-void __attribute__ ((constructor)) gnc_ltdl_init(void) {
+void __attribute__ ((constructor)) gnc_ltdl_init() {
int err;
const char * opath;
char * path;
@@ -62,7 +62,7 @@
}
}
-void __attribute__ ((destructor)) gnc_ltdl_fini(void) {
+void __attribute__ ((destructor)) gnc_ltdl_fini() {
lt_dlsetsearchpath(old_dlsearchpath);
if (old_dlsearchpath != NULL) {
FREE(old_dlsearchpath);
Modified: GNUnet/src/util/os/installpath.c
===================================================================
--- GNUnet/src/util/os/installpath.c 2006-09-07 13:15:47 UTC (rev 3377)
+++ GNUnet/src/util/os/installpath.c 2006-09-08 03:34:31 UTC (rev 3378)
@@ -48,11 +48,10 @@
*/
static char *
get_path_from_proc_exe() {
- char * fn;
+ char fn[64];
char * lnk;
size_t size;
- fn = MALLOC(64);
SNPRINTF(fn,
64,
"/proc/%u/exe",
@@ -64,11 +63,9 @@
GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
"readlink",
fn);
- FREE(fn);
FREE(lnk);
return NULL;
}
- FREE(fn);
lnk[size] = '\0';
while ( (lnk[size] != '/') &&
(size > 0) )
@@ -88,7 +85,7 @@
/**
* Try to determine path with win32-specific function
*/
-char * get_path_from_module_filename() {
+static char * get_path_from_module_filename() {
char * path;
char * idx;
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-09-07 13:15:47 UTC (rev 3377)
+++ GNUnet/todo 2006-09-08 03:34:31 UTC (rev 3378)
@@ -18,6 +18,7 @@
+ loggers: SMTP logger
+ use new loggers in for CS error reporting
* make testcases compile & pass again:
+ + fs/lib -- strange crashes?
+ fs/ecrs -- compiles, but searchtest hangs
+ gap
+ fs/namespace
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3378 - in GNUnet: . src/applications/session src/applications/tbench src/util/os,
grothoff <=