[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5592 - GNUnet/src/transports
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5592 - GNUnet/src/transports |
Date: |
Tue, 4 Sep 2007 10:27:12 -0600 (MDT) |
Author: grothoff
Date: 2007-09-04 10:27:12 -0600 (Tue, 04 Sep 2007)
New Revision: 5592
Added:
GNUnet/src/transports/test.conf
Modified:
GNUnet/src/transports/Makefile.am
GNUnet/src/transports/test.c
Log:
testcase
Modified: GNUnet/src/transports/Makefile.am
===================================================================
--- GNUnet/src/transports/Makefile.am 2007-09-04 11:24:19 UTC (rev 5591)
+++ GNUnet/src/transports/Makefile.am 2007-09-04 16:27:12 UTC (rev 5592)
@@ -1,6 +1,6 @@
INCLUDES = -I$(top_srcdir)/src/include
-EXTRA_DIST = tcp_helper.c udp_helper.c
+EXTRA_DIST = tcp_helper.c udp_helper.c test.conf
plugindir = $(libdir)/GNUnet
Modified: GNUnet/src/transports/test.c
===================================================================
--- GNUnet/src/transports/test.c 2007-09-04 11:24:19 UTC (rev 5591)
+++ GNUnet/src/transports/test.c 2007-09-04 16:27:12 UTC (rev 5592)
@@ -34,10 +34,14 @@
#include "gnunet_protocols.h"
#include "gnunet_transport.h"
+#define ROUNDS 1
+
+#define OFFSET 10
+
/**
* Name of the configuration file.
*/
-static char *cfgFilename = DEFAULT_DAEMON_CONFIG_FILE;
+static char *cfgFilename = "test.conf";
/**
* Transport being tested.
@@ -134,7 +138,11 @@
char * trans;
int res;
int pos;
+ TSession * tsession;
+ P2P_hello_MESSAGE * hello;
+ memset(&api, 0,
+ sizeof(CoreAPIForTransport));
pid = fork();
res = GNUNET_init (argc,
argv,
@@ -162,12 +170,13 @@
GC_set_configuration_value_string (api.cfg, api.ectx, "TCP", "UPNP", "NO");
GC_set_configuration_value_string (api.cfg, api.ectx, "TCP6", "BLACKLIST",
"");
GC_set_configuration_value_string (api.cfg, api.ectx, "UDP", "BLACKLIST",
"");
+ GC_set_configuration_value_string (api.cfg, api.ectx, "UDP", "UPNP", "NO");
GC_set_configuration_value_string (api.cfg, api.ectx, "UDP6", "BLACKLIST",
"");
GC_set_configuration_value_string (api.cfg, api.ectx, "HTTP", "BLACKLIST",
"");
GC_set_configuration_value_string (api.cfg, api.ectx, "HTTP", "UPNP", "NO");
if (pid == 0)
- pos = 10;
+ pos = OFFSET;
else
pos = 0;
GC_set_configuration_value_number (api.cfg, api.ectx, "TCP", "PORT",
4444+pos);
@@ -212,10 +221,33 @@
GNUNET_SHUTDOWN_WAITFOR();
} else {
/* client - initiate requests */
- // FIXME!
-
-
-
+ hello = transport->createhello();
+ /* HACK hello -- change port! */
+ ((unsigned short*) &hello[1])[2] = htons(ntohl(((unsigned short*)
&hello[1])[2]) + OFFSET);
+ if (OK != transport->connect(hello,
+ &tsession,
+ NO)) {
+ FREE(hello);
+ transport->stopTransportServer();
+ os_plugin_unload(plugin);
+ goto cleanup;
+ }
+ FREE(hello);
+ pos=0;
+ while (pos < ROUNDS) {
+ if (OK == transport->send(tsession,
+ expectedValue,
+ expectedSize,
+ pos > ROUNDS / 2 ? YES : NO))
+ pos++;
+ }
+ pos = 0;
+ while ( (pos++ < 100) &&
+ (msg_count < ROUNDS) )
+ PTHREAD_SLEEP(50 * cronMILLIS);
+ if (msg_count < ROUNDS)
+ res = SYSERR;
+ transport->disconnect(tsession);
}
transport->stopTransportServer();
Added: GNUnet/src/transports/test.conf
===================================================================
--- GNUnet/src/transports/test.conf (rev 0)
+++ GNUnet/src/transports/test.conf 2007-09-04 16:27:12 UTC (rev 5592)
@@ -0,0 +1,40 @@
+[PATHS]
+GNUNETD_HOME = /tmp/transport-test
+
+[Meta]
+ADVANCED = YES
+RARE = YES
+EXPERIMENTAL = NO
+
+[GNUNETD]
+TRANSPORTS = udp tcp nat
+KEEPLOG = 3
+LOGFILE = $GNUNETD_HOME/daemon-logs
+
+[NETWORK]
+IP = 127.0.0.1
+
+[LOGGING]
+USER-LEVEL = WARNING
+ADMIN-LEVEL = WARNING
+
+[TCP]
+PORT = 2086
+
+[TCP6]
+PORT = 2088
+BLACKLIST =
+
+[UDP]
+PORT = 2086
+MTU = 1472
+BLACKLIST =
+
+[UDP6]
+PORT = 2088
+MTU = 1452
+BLACKLIST =
+
+[HTTP]
+PORT = 1080
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5592 - GNUnet/src/transports,
gnunet <=