summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-02-01 12:08:51 +0000
committerNathan S. Evans <evans@in.tum.de>2010-02-01 12:08:51 +0000
commit1ae18596e812235ee505338bb2fbfd445ae9d6cf (patch)
tree3f65bd21bae7574e1ade4a0bfb6315b12ecd3335 /src/transport
parent63aa9b10e3f94249a3308ef52fad4445211f3596 (diff)
change test cases to not write configs
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport.c31
-rw-r--r--src/transport/test_transport_api.c19
-rw-r--r--src/transport/test_transport_api_tcp_peer1.conf133
-rw-r--r--src/transport/test_transport_api_tcp_peer2.conf133
-rw-r--r--src/transport/test_transport_api_udp_peer1.conf (renamed from src/transport/test_transport_api_peer1.conf)6
-rw-r--r--src/transport/test_transport_api_udp_peer2.conf (renamed from src/transport/test_transport_api_peer2.conf)6
6 files changed, 304 insertions, 24 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index bd0f33232..81945c511 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -24,8 +24,7 @@
* @author Christian Grothoff
*
* TODO:
- * - if we do not receive an ACK in response to our
- * HELLO, retransmit HELLO!
+ * - remove AddressValidations, incorporate them into the PeerAddressLists
*/
#include "platform.h"
#include "gnunet_client_lib.h"
@@ -307,7 +306,12 @@ struct MessageQueue
/**
* Neighbor this entry belongs to.
*/
- struct NeighborList *neighbor;
+ /*struct NeighborList *neighbor;*/
+
+ /**
+ * Peer ID of the Neighbor this entry belongs to.
+ */
+ struct GNUNET_PeerIdentity *neighbor_id;
/**
* Plugin that we used for the transmission.
@@ -1060,16 +1064,14 @@ transmit_send_continuation (void *cls,
struct NeighborList *n;
GNUNET_assert (mq != NULL);
- n = mq->neighbor;
- GNUNET_assert (n != NULL);
+ n = find_neighbor(mq->neighbor_id);
+ if (n == NULL) /* Neighbor must have been removed asynchronously! */
+ return;
+
+ /* Otherwise, let's make sure we've got the right peer */
GNUNET_assert (0 ==
memcmp (&n->id, target,
sizeof (struct GNUNET_PeerIdentity)));
-/* rl = n->plugins;
- while ((rl != NULL) && (rl->plugin != mq->plugin))
- rl = rl->next;
- GNUNET_assert (rl != NULL);
-*/
if (result == GNUNET_OK)
{
@@ -1221,7 +1223,7 @@ try_transmission_to_peer (struct NeighborList *neighbor)
#endif
return rl->plugin->api->send (rl->plugin->api->cls,
- &neighbor->id,
+ mq->neighbor_id,
mq->message_buf,
mq->message_buf_size,
mq->priority,
@@ -1280,7 +1282,9 @@ transmit_to_peer (struct TransportClient *client,
memcpy (m, message_buf, message_buf_size);
mq->message_buf = m;
mq->message_buf_size = message_buf_size;
- mq->neighbor = neighbor;
+ mq->neighbor_id = GNUNET_malloc(sizeof (struct GNUNET_PeerIdentity));
+
+ memcpy(mq->neighbor_id, &neighbor->id, sizeof(struct GNUNET_PeerIdentity));
mq->internal_msg = is_internal;
mq->priority = priority;
@@ -1882,6 +1886,7 @@ add_peer_address(struct NeighborList *neighbor, const char *addr, size_t addrlen
GNUNET_assert(addr != NULL);
+ new_address = NULL;
while (head != NULL)
{
new_address = GNUNET_malloc(sizeof(struct PeerAddressList));
@@ -2303,7 +2308,7 @@ disconnect_neighbor (struct NeighborList *current_handle, int check)
while (NULL != (mq = n->messages))
{
n->messages = mq->next;
- GNUNET_assert (mq->neighbor == n);
+ GNUNET_assert (0 == memcmp(mq->neighbor_id, &n->id, sizeof(struct GNUNET_PeerIdentity)));
GNUNET_free (mq);
}
if (n->timeout_task != GNUNET_SCHEDULER_NO_TASK)
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index dd9321546..b761f33af 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -259,6 +259,7 @@ exchange_hello (void *cls,
GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2);
}
+#if WRITECONFIG
static void
setTransportOptions(char * filename)
{
@@ -294,6 +295,7 @@ setTransportOptions(char * filename)
GNUNET_CONFIGURATION_destroy(tempcfg);
return;
}
+#endif
static void
run (void *cls,
@@ -305,14 +307,19 @@ run (void *cls,
OKPP;
sched = s;
- setTransportOptions("test_transport_api_peer1.conf");
- setTransportOptions("test_transport_api_peer2.conf");
-
die_task = GNUNET_SCHEDULER_add_delayed (sched,
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 1), &end_badly, NULL);
- setup_peer (&p1, "test_transport_api_peer1.conf");
- setup_peer (&p2, "test_transport_api_peer2.conf");
+ if (is_udp)
+ {
+ setup_peer (&p1, "test_transport_api_udp_peer1.conf");
+ setup_peer (&p2, "test_transport_api_udp_peer2.conf");
+ }
+ else if (is_tcp)
+ {
+ setup_peer (&p1, "test_transport_api_tcp_peer1.conf");
+ setup_peer (&p2, "test_transport_api_tcp_peer2.conf");
+ }
GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1);
}
@@ -330,7 +337,9 @@ check ()
NULL
};
+#if WRITECONFIG
setTransportOptions("test_transport_api_data.conf");
+#endif
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
diff --git a/src/transport/test_transport_api_tcp_peer1.conf b/src/transport/test_transport_api_tcp_peer1.conf
new file mode 100644
index 000000000..7af00db9c
--- /dev/null
+++ b/src/transport/test_transport_api_tcp_peer1.conf
@@ -0,0 +1,133 @@
+[transport-tcp]
+PORT = 12368
+
+[fs]
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-fs
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 2094
+INDEXDB = $SERVICEHOME/idxinfo.lst
+
+[datastore-sqlite]
+FILENAME = $SERVICEHOME/datastore/sqlite.db
+
+[datastore]
+DATABASE = sqlite
+BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
+QUOTA = 100000000
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-datastore
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 2093
+
+[hostlist]
+HTTP-PROXY =
+SERVERS = http://gnunet.org:8080/
+OPTIONS = -b
+BINARY = gnunet-daemon-hostlist
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+HTTPPORT = 8080
+
+[topology]
+BINARY = gnunet-daemon-topology
+CONFIG = $DEFAULTCONFIG
+FRIENDS = $SERVICEHOME/friends
+TARGET-CONNECTION-COUNT = 16
+AUTOCONNECT = YES
+FRIENDS-ONLY = NO
+MINIMUM-FRIENDS = 0
+
+[core]
+TOTAL_QUOTA_OUT = 3932160
+TOTAL_QUOTA_IN = 3932160
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-core
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 2092
+
+[transport]
+PLUGINS = tcp
+DEBUG = NO
+PREFIX =
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+NEIGHBOUR_LIMIT = 50
+BINARY = gnunet-service-transport
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 12365
+
+[peerinfo]
+TRUST = $SERVICEHOME/data/credit/
+HOSTS = $SERVICEHOME/data/hosts/
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-peerinfo
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 12369
+
+[resolver]
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-resolver
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 12364
+
+[statistics]
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-statistics
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 12367
+
+[arm]
+DEFAULTSERVICES =
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-arm
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 12366
+
+[transport-tcp]
+ALLOW_SHUTDOWN = NO
+TIMEOUT = 300000
+PORT = 12368
+
+[TESTING]
+WEAKRANDOM = YES
+
+[gnunetd]
+HOSTKEY = $SERVICEHOME/.hostkey
+
+[PATHS]
+DEFAULTCONFIG = test_transport_api_tcp_peer1.conf
+SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/
+
diff --git a/src/transport/test_transport_api_tcp_peer2.conf b/src/transport/test_transport_api_tcp_peer2.conf
new file mode 100644
index 000000000..34fa8cf64
--- /dev/null
+++ b/src/transport/test_transport_api_tcp_peer2.conf
@@ -0,0 +1,133 @@
+[transport-tcp]
+PORT = 22368
+
+[fs]
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-fs
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 2094
+INDEXDB = $SERVICEHOME/idxinfo.lst
+
+[datastore-sqlite]
+FILENAME = $SERVICEHOME/datastore/sqlite.db
+
+[datastore]
+DATABASE = sqlite
+BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
+QUOTA = 100000000
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-datastore
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 2093
+
+[hostlist]
+HTTP-PROXY =
+SERVERS = http://gnunet.org:8080/
+OPTIONS = -b
+BINARY = gnunet-daemon-hostlist
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+HTTPPORT = 8080
+
+[topology]
+BINARY = gnunet-daemon-topology
+CONFIG = $DEFAULTCONFIG
+FRIENDS = $SERVICEHOME/friends
+TARGET-CONNECTION-COUNT = 16
+AUTOCONNECT = YES
+FRIENDS-ONLY = NO
+MINIMUM-FRIENDS = 0
+
+[core]
+TOTAL_QUOTA_OUT = 3932160
+TOTAL_QUOTA_IN = 3932160
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-core
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 2092
+
+[transport]
+PLUGINS = tcp
+DEBUG = NO
+PREFIX =
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+NEIGHBOUR_LIMIT = 50
+BINARY = gnunet-service-transport
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 22365
+
+[peerinfo]
+TRUST = $SERVICEHOME/data/credit/
+HOSTS = $SERVICEHOME/data/hosts/
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-peerinfo
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 22369
+
+[resolver]
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-resolver
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 22364
+
+[statistics]
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-statistics
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 22367
+
+[arm]
+DEFAULTSERVICES =
+ALLOW_SHUTDOWN = YES
+ACCEPT_FROM6 = ::1;
+ACCEPT_FROM = 127.0.0.1;
+BINARY = gnunet-service-arm
+CONFIG = $DEFAULTCONFIG
+HOME = $SERVICEHOME
+HOSTNAME = localhost
+PORT = 22366
+
+[transport-tcp]
+ALLOW_SHUTDOWN = NO
+TIMEOUT = 300000
+PORT = 22368
+
+[TESTING]
+WEAKRANDOM = YES
+
+[gnunetd]
+HOSTKEY = $SERVICEHOME/.hostkey
+
+[PATHS]
+DEFAULTCONFIG = test_transport_api_tcp_peer2.conf
+SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/
+
diff --git a/src/transport/test_transport_api_peer1.conf b/src/transport/test_transport_api_udp_peer1.conf
index 1017be62f..6a3200b01 100644
--- a/src/transport/test_transport_api_peer1.conf
+++ b/src/transport/test_transport_api_udp_peer1.conf
@@ -60,9 +60,9 @@ HOSTNAME = localhost
PORT = 2092
[transport]
-PREFIX =
-DEBUG = NO
PLUGINS = udp
+DEBUG = NO
+PREFIX =
ALLOW_SHUTDOWN = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
@@ -128,6 +128,6 @@ WEAKRANDOM = YES
HOSTKEY = $SERVICEHOME/.hostkey
[PATHS]
-DEFAULTCONFIG = test_transport_api_peer1.conf
+DEFAULTCONFIG = test_transport_api_udp_peer1.conf
SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/
diff --git a/src/transport/test_transport_api_peer2.conf b/src/transport/test_transport_api_udp_peer2.conf
index 7385d9758..14ae37f6b 100644
--- a/src/transport/test_transport_api_peer2.conf
+++ b/src/transport/test_transport_api_udp_peer2.conf
@@ -60,9 +60,9 @@ HOSTNAME = localhost
PORT = 2092
[transport]
-PREFIX =
-DEBUG = NO
PLUGINS = udp
+DEBUG = NO
+PREFIX =
ALLOW_SHUTDOWN = YES
ACCEPT_FROM6 = ::1;
ACCEPT_FROM = 127.0.0.1;
@@ -128,6 +128,6 @@ WEAKRANDOM = YES
HOSTKEY = $SERVICEHOME/.hostkey
[PATHS]
-DEFAULTCONFIG = test_transport_api_peer2.conf
+DEFAULTCONFIG = test_transport_api_udp_peer2.conf
SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/