aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-06-14 18:30:49 +0000
committerNathan S. Evans <evans@in.tum.de>2010-06-14 18:30:49 +0000
commit18308311e0d3f83ca05171b060430428d65ae0dd (patch)
treef90ca31cc1077732103251c16dbb0ce1c8a7cc37 /src
parent90a4c9922ef5fe5d15b832598449de8663b110bb (diff)
downloadgnunet-18308311e0d3f83ca05171b060430428d65ae0dd.tar.gz
gnunet-18308311e0d3f83ca05171b060430428d65ae0dd.zip
dv changes, still working out an issue
Diffstat (limited to 'src')
-rw-r--r--src/dv/Makefile.am20
-rw-r--r--src/dv/dv.h2
-rw-r--r--src/dv/gnunet-service-dv.c33
-rw-r--r--src/dv/test_dv_topology.c5
-rw-r--r--src/dv/test_transport_api_dv.c1158
-rw-r--r--src/dv/test_transport_api_dv_peer1.conf31
-rw-r--r--src/dv/test_transport_api_dv_peer2.conf30
-rw-r--r--src/dv/test_transport_api_dv_peer3.conf30
-rw-r--r--src/dv/test_transport_api_dv_peer4.conf10
9 files changed, 757 insertions, 562 deletions
diff --git a/src/dv/Makefile.am b/src/dv/Makefile.am
index 9d5dc1ab1..99a3e6114 100644
--- a/src/dv/Makefile.am
+++ b/src/dv/Makefile.am
@@ -50,8 +50,8 @@ libgnunet_plugin_transport_dv_la_LDFLAGS = \
50 50
51 51
52check_PROGRAMS = \ 52check_PROGRAMS = \
53 test_transport_api_dv \ 53 test_transport_api_dv
54 test_dv_topology 54# test_dv_topology
55 55
56TESTS = $(check_PROGRAMS) $(check_SCRIPTS) 56TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
57 57
@@ -59,17 +59,19 @@ test_transport_api_dv_SOURCES = \
59 test_transport_api_dv.c 59 test_transport_api_dv.c
60test_transport_api_dv_LDADD = \ 60test_transport_api_dv_LDADD = \
61 $(top_builddir)/src/transport/libgnunettransport.la \ 61 $(top_builddir)/src/transport/libgnunettransport.la \
62 $(top_builddir)/src/util/libgnunetutil.la 62 $(top_builddir)/src/util/libgnunetutil.la \
63
64test_dv_topology_SOURCES = \
65 test_dv_topology.c
66test_dv_topology_LDADD = \
67 $(top_builddir)/src/transport/libgnunettransport.la \
68 $(top_builddir)/src/util/libgnunetutil.la \
69 $(top_builddir)/src/testing/libgnunettesting.la 63 $(top_builddir)/src/testing/libgnunettesting.la
70 64
65#test_dv_topology_SOURCES = \
66# test_dv_topology.c
67#test_dv_topology_LDADD = \
68# $(top_builddir)/src/transport/libgnunettransport.la \
69# $(top_builddir)/src/util/libgnunetutil.la \
70# $(top_builddir)/src/testing/libgnunettesting.la
71
71 72
72EXTRA_DIST = \ 73EXTRA_DIST = \
74 test_transport_dv_data.conf \
73 test_transport_api_dv_peer1.conf \ 75 test_transport_api_dv_peer1.conf \
74 test_transport_api_dv_peer2.conf \ 76 test_transport_api_dv_peer2.conf \
75 test_transport_api_dv_peer3.conf 77 test_transport_api_dv_peer3.conf
diff --git a/src/dv/dv.h b/src/dv/dv.h
index f80ecd4ed..21350b28c 100644
--- a/src/dv/dv.h
+++ b/src/dv/dv.h
@@ -31,7 +31,7 @@
31#define DEBUG_DV_GOSSIP GNUNET_NO 31#define DEBUG_DV_GOSSIP GNUNET_NO
32#define DEBUG_DV_GOSSIP_SEND GNUNET_YES 32#define DEBUG_DV_GOSSIP_SEND GNUNET_YES
33#define DEBUG_DV_GOSSIP_RECEIPT GNUNET_YES 33#define DEBUG_DV_GOSSIP_RECEIPT GNUNET_YES
34#define DEBUG_DV GNUNET_YES 34#define DEBUG_DV GNUNET_NO
35#define DEBUG_DV_API GNUNET_YES 35#define DEBUG_DV_API GNUNET_YES
36 36
37typedef void (*GNUNET_DV_MessageReceivedHandler) (void *cls, 37typedef void (*GNUNET_DV_MessageReceivedHandler) (void *cls,
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c
index 3a0d4f936..16e10d674 100644
--- a/src/dv/gnunet-service-dv.c
+++ b/src/dv/gnunet-service-dv.c
@@ -45,6 +45,8 @@
45#include "gnunet_crypto_lib.h" 45#include "gnunet_crypto_lib.h"
46#include "dv.h" 46#include "dv.h"
47 47
48#define DEBUG_DV_PEER_NUMBERS GNUNET_YES
49
48/** 50/**
49 * DV Service Context stuff goes here... 51 * DV Service Context stuff goes here...
50 */ 52 */
@@ -722,10 +724,12 @@ void send_to_plugin(const struct GNUNET_PeerIdentity * sender,
722 size, GNUNET_TIME_UNIT_FOREVER_REL, 724 size, GNUNET_TIME_UNIT_FOREVER_REL,
723 &transmit_to_plugin, NULL); 725 &transmit_to_plugin, NULL);
724 } 726 }
727#if DEBUG_DV
725 else 728 else
726 { 729 {
727 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to queue message for plugin, must be one in progress already!!\n"); 730 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to queue message for plugin, must be one in progress already!!\n");
728 } 731 }
732#endif
729 } 733 }
730} 734}
731 735
@@ -1026,9 +1030,10 @@ static int handle_dv_data_message (void *cls,
1026 pos = dn->referee_head; 1030 pos = dn->referee_head;
1027 while ((NULL != pos) && (pos->referrer_id != sid)) 1031 while ((NULL != pos) && (pos->referrer_id != sid))
1028 pos = pos->next; 1032 pos = pos->next;
1033
1029 if (pos == NULL) 1034 if (pos == NULL)
1030 { 1035 {
1031#if DEBUG_DV 1036#if DEBUG_DV_PEER_NUMBERS
1032 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1037 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1033 "%s peer %s: unknown sender (%d)!\n", "DV SERVICE", GNUNET_i2s(&my_identity), ntohl(incoming->sender), GNUNET_CONTAINER_multihashmap_size (ctx.extended_neighbors)); 1038 "%s peer %s: unknown sender (%d)!\n", "DV SERVICE", GNUNET_i2s(&my_identity), ntohl(incoming->sender), GNUNET_CONTAINER_multihashmap_size (ctx.extended_neighbors));
1034#endif 1039#endif
@@ -1040,7 +1045,6 @@ static int handle_dv_data_message (void *cls,
1040 if (tid == 0) 1045 if (tid == 0)
1041 { 1046 {
1042 /* 0 == us */ 1047 /* 0 == us */
1043
1044 cbuf = (char *)&incoming[1]; 1048 cbuf = (char *)&incoming[1];
1045 offset = 0; 1049 offset = 0;
1046 while(offset < packed_message_size) 1050 while(offset < packed_message_size)
@@ -1187,9 +1191,9 @@ neighbor_send_task (void *cls,
1187 encPeerAbout = GNUNET_strdup(GNUNET_i2s(&about->identity)); 1191 encPeerAbout = GNUNET_strdup(GNUNET_i2s(&about->identity));
1188 encPeerTo = GNUNET_strdup(GNUNET_i2s(&to->identity)); 1192 encPeerTo = GNUNET_strdup(GNUNET_i2s(&to->identity));
1189 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1193 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1190 "%s: Sending info about peer %s to directly connected peer %s\n", 1194 "%s: Sending info about peer %s id %u to directly connected peer %s\n",
1191 GNUNET_i2s(&my_identity), 1195 GNUNET_i2s(&my_identity),
1192 encPeerAbout, encPeerTo); 1196 encPeerAbout, about->our_id, encPeerTo);
1193 GNUNET_free(encPeerAbout); 1197 GNUNET_free(encPeerAbout);
1194 GNUNET_free(encPeerTo); 1198 GNUNET_free(encPeerTo);
1195#endif 1199#endif
@@ -1217,12 +1221,16 @@ neighbor_send_task (void *cls,
1217 1221
1218 if (send_context->fast_gossip_list_head != NULL) /* If there are other peers in the fast list, schedule right away */ 1222 if (send_context->fast_gossip_list_head != NULL) /* If there are other peers in the fast list, schedule right away */
1219 { 1223 {
1224#if DEBUG_DV
1220 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV SERVICE: still in fast send mode\n"); 1225 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV SERVICE: still in fast send mode\n");
1226#endif
1221 send_context->task = GNUNET_SCHEDULER_add_now(sched, &neighbor_send_task, send_context); 1227 send_context->task = GNUNET_SCHEDULER_add_now(sched, &neighbor_send_task, send_context);
1222 } 1228 }
1223 else 1229 else
1224 { 1230 {
1231#if DEBUG_DV
1225 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV SERVICE: entering slow send mode\n"); 1232 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV SERVICE: entering slow send mode\n");
1233#endif
1226 send_context->task = GNUNET_SCHEDULER_add_delayed(sched, GNUNET_DV_DEFAULT_SEND_INTERVAL, &neighbor_send_task, send_context); 1234 send_context->task = GNUNET_SCHEDULER_add_delayed(sched, GNUNET_DV_DEFAULT_SEND_INTERVAL, &neighbor_send_task, send_context);
1227 } 1235 }
1228 1236
@@ -1738,9 +1746,12 @@ addUpdateNeighbor (const struct GNUNET_PeerIdentity * peer, struct GNUNET_CRYPTO
1738 struct NeighborUpdateInfo *neighbor_update; 1746 struct NeighborUpdateInfo *neighbor_update;
1739 unsigned int our_id; 1747 unsigned int our_id;
1740 1748
1741 now = GNUNET_TIME_absolute_get (); 1749#if DEBUG_DV_PEER_NUMBERS
1742 our_id = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, RAND_MAX - 1) + 1; 1750 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1751 "%s Received sender id (%u)!\n", "DV SERVICE", referrer_peer_id);
1752#endif
1743 1753
1754 now = GNUNET_TIME_absolute_get ();
1744 neighbor = GNUNET_CONTAINER_multihashmap_get (ctx.extended_neighbors, 1755 neighbor = GNUNET_CONTAINER_multihashmap_get (ctx.extended_neighbors,
1745 &peer->hashPubKey); 1756 &peer->hashPubKey);
1746 neighbor_update = GNUNET_malloc(sizeof(struct NeighborUpdateInfo)); 1757 neighbor_update = GNUNET_malloc(sizeof(struct NeighborUpdateInfo));
@@ -1749,6 +1760,13 @@ addUpdateNeighbor (const struct GNUNET_PeerIdentity * peer, struct GNUNET_CRYPTO
1749 neighbor_update->now = now; 1760 neighbor_update->now = now;
1750 neighbor_update->referrer = referrer; 1761 neighbor_update->referrer = referrer;
1751 1762
1763
1764 our_id = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, RAND_MAX - 1) + 1;
1765#if DEBUG_DV_PEER_NUMBERS
1766 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1767 "%s Chose NEW id (%u)!\n", "DV SERVICE", our_id);
1768#endif
1769
1752 /* Either we do not know this peer, or we already do but via a different immediate peer */ 1770 /* Either we do not know this peer, or we already do but via a different immediate peer */
1753 if ((neighbor == NULL) || 1771 if ((neighbor == NULL) ||
1754 (GNUNET_CONTAINER_multihashmap_get_multiple(ctx.extended_neighbors, 1772 (GNUNET_CONTAINER_multihashmap_get_multiple(ctx.extended_neighbors,
@@ -1807,6 +1825,7 @@ addUpdateNeighbor (const struct GNUNET_PeerIdentity * peer, struct GNUNET_CRYPTO
1807 neighbor->hidden = 1825 neighbor->hidden =
1808 (cost == DIRECT_NEIGHBOR_COST) ? (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 4) == 1826 (cost == DIRECT_NEIGHBOR_COST) ? (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 4) ==
1809 0) : GNUNET_NO; 1827 0) : GNUNET_NO;
1828
1810 GNUNET_CONTAINER_multihashmap_put (ctx.extended_neighbors, &peer->hashPubKey, 1829 GNUNET_CONTAINER_multihashmap_put (ctx.extended_neighbors, &peer->hashPubKey,
1811 neighbor, 1830 neighbor,
1812 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1831 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
@@ -1944,7 +1963,7 @@ static int handle_dv_gossip_message (void *cls,
1944 encPeerAbout = GNUNET_strdup(GNUNET_i2s(&enc_message->neighbor)); 1963 encPeerAbout = GNUNET_strdup(GNUNET_i2s(&enc_message->neighbor));
1945 encPeerFrom = GNUNET_strdup(GNUNET_i2s(peer)); 1964 encPeerFrom = GNUNET_strdup(GNUNET_i2s(peer));
1946 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1965 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1947 "%s: Receives %s message from peer %s about peer %s distance %d!\n", "dv", "DV GOSSIP", encPeerFrom, encPeerAbout, ntohl (enc_message->cost) + 1); 1966 "%s: Receives %s message from peer %s about peer %s id %u distance %d!\n", "dv", "DV GOSSIP", encPeerFrom, encPeerAbout, ntohl(enc_message->neighbor_id), ntohl (enc_message->cost) + 1);
1948 GNUNET_free(encPeerAbout); 1967 GNUNET_free(encPeerAbout);
1949 GNUNET_free(encPeerFrom); 1968 GNUNET_free(encPeerFrom);
1950#endif 1969#endif
diff --git a/src/dv/test_dv_topology.c b/src/dv/test_dv_topology.c
index c7f213a07..06f4b09ea 100644
--- a/src/dv/test_dv_topology.c
+++ b/src/dv/test_dv_topology.c
@@ -275,7 +275,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
275 275
276 if (pg != NULL) 276 if (pg != NULL)
277 { 277 {
278 GNUNET_TESTING_daemons_stop (pg); 278 GNUNET_TESTING_daemons_stop (pg, TIMEOUT);
279 ok = 7331; /* Opposite of leet */ 279 ok = 7331; /* Opposite of leet */
280 } 280 }
281 else 281 else
@@ -584,7 +584,7 @@ create_topology ()
584 maybe this way is best so that the client can know both 584 maybe this way is best so that the client can know both
585 when peers are started, and when they are connected. 585 when peers are started, and when they are connected.
586 */ 586 */
587 expected_connections = GNUNET_TESTING_create_topology (pg, topology); 587 expected_connections = GNUNET_TESTING_create_topology (pg, topology, GNUNET_TESTING_TOPOLOGY_NONE, "");
588#if VERBOSE 588#if VERBOSE
589 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 589 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
590 "Have %d expected connections\n", expected_connections); 590 "Have %d expected connections\n", expected_connections);
@@ -686,6 +686,7 @@ run (void *cls,
686 pg = GNUNET_TESTING_daemons_start (sched, cfg, 686 pg = GNUNET_TESTING_daemons_start (sched, cfg,
687 peers_left, 687 peers_left,
688 TIMEOUT, 688 TIMEOUT,
689 NULL, NULL,
689 &my_cb, NULL, 690 &my_cb, NULL,
690 &topology_callback, NULL, NULL); 691 &topology_callback, NULL, NULL);
691 692
diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c
index 50eeeb60c..33c1b936f 100644
--- a/src/dv/test_transport_api_dv.c
+++ b/src/dv/test_transport_api_dv.c
@@ -18,637 +18,859 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20/** 20/**
21 * @file transport/test_transport_api_dv.c 21 * @file dv/test_transport_api_dv.c
22 * @brief base test case for dv transport (separated from other transport 22 * @brief base testcase for testing distance vector transport
23 * testcases for two reasons. 1) dv-service relies on core and other
24 * transport plugins, dv plugin relies on dv-service, so dv-plugin needs
25 * to live here, and 2) a dv plugin testcase is different from other
26 * tranport plugin testcases because we need at least three peer to test
27 * it.
28 *
29 * This test case tests DV functionality. Specifically it starts three
30 * peers connected in a line (1 <-> 2 <-> 3). Then a message is transmitted
31 * from peer 1 to peer 3. Assuming that DV is working, peer 2 should have
32 * gossiped about peer 3 to 1, and should then forward a message from one
33 * to 3.
34 */ 23 */
35#include "platform.h" 24#include "platform.h"
36#include "gnunet_common.h" 25#include "gnunet_testing_lib.h"
37#include "gnunet_hello_lib.h" 26#include "gnunet_core_service.h"
38#include "gnunet_getopt_lib.h"
39#include "gnunet_os_lib.h"
40#include "gnunet_program_lib.h"
41#include "gnunet_scheduler_lib.h"
42#include "gnunet_transport_service.h"
43#include "../transport/transport.h"
44 27
45#define VERBOSE GNUNET_YES 28#define VERBOSE GNUNET_YES
46 29
47#define VERBOSE_ARM GNUNET_NO 30/**
48 31 * How long until we fail the whole testcase?
49#define START_ARM GNUNET_YES 32 */
33#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
50 34
51/** 35/**
52 * How long until we give up on transmitting the message? 36 * How long until we give up on starting the peers?
53 */ 37 */
54#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 50) 38#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 500)
55 39
56#define MTYPE 12345 40#define DEFAULT_NUM_PEERS 4
57 41
58static int num_wanted = 2; 42#define MAX_OUTSTANDING_CONNECTIONS 100
59 43
60static int num_received = 0; 44static float fail_percentage = 0.00;
61 45
62struct PeerContext 46static int ok;
63{
64 struct GNUNET_CONFIGURATION_Handle *cfg;
65 struct GNUNET_TRANSPORT_Handle *th;
66 struct GNUNET_PeerIdentity id;
67 const char *cfg_file;
68 struct GNUNET_HELLO_Message *hello;
69#if START_ARM
70 pid_t arm_pid;
71#endif
72};
73 47
74static struct PeerContext p1; 48static unsigned long long num_peers;
75 49
76static struct PeerContext p2; 50static unsigned int total_connections;
77 51
78static struct PeerContext p3; 52static unsigned int failed_connections;
79 53
80static struct PeerContext p4; 54static unsigned int total_server_connections;
55
56static unsigned int total_messages_received;
57
58static unsigned int expected_messages;
59
60static unsigned int expected_connections;
61
62static unsigned long long peers_left;
63
64static struct GNUNET_TESTING_PeerGroup *pg;
81 65
82static struct GNUNET_SCHEDULER_Handle *sched; 66static struct GNUNET_SCHEDULER_Handle *sched;
83 67
84static int ok; 68const struct GNUNET_CONFIGURATION_Handle *main_cfg;
85 69
86GNUNET_SCHEDULER_TaskIdentifier die_task; 70GNUNET_SCHEDULER_TaskIdentifier die_task;
87 71
88#if VERBOSE 72static char *dotOutFileName = "topology.dot";
89#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
90#else
91#define OKPP do { ok++; } while (0)
92#endif
93 73
74static FILE *dotOutFile;
94 75
95static void 76static char *blacklist_transports;
96end () 77
78static int transmit_ready_scheduled;
79
80static int transmit_ready_failed;
81
82static int transmit_ready_called;
83
84static enum GNUNET_TESTING_Topology topology;
85
86static enum GNUNET_TESTING_Topology blacklist_topology = GNUNET_TESTING_TOPOLOGY_NONE; /* Don't do any blacklisting */
87
88static enum GNUNET_TESTING_Topology connection_topology = GNUNET_TESTING_TOPOLOGY_NONE; /* NONE actually means connect all allowed peers */
89
90static enum GNUNET_TESTING_TopologyOption connect_topology_option = GNUNET_TESTING_TOPOLOGY_OPTION_ALL;
91
92static double connect_topology_option_modifier = 0.0;
93
94static char *test_directory;
95
96#define MTYPE 12345
97
98struct GNUNET_TestMessage
97{ 99{
98 /* do work here */ 100 /**
99 GNUNET_SCHEDULER_cancel (sched, die_task); 101 * Header of the message
102 */
103 struct GNUNET_MessageHeader header;
104
105 /**
106 * Unique identifier for this message.
107 */
108 uint32_t uid;
109};
100 110
101 if (p1.th != NULL) 111struct PeerContext
102 { 112{
103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transport 1!\n"); 113 /* This is a linked list */
104 GNUNET_TRANSPORT_disconnect (p1.th); 114 struct PeerContext *next;
105 p1.th = NULL; 115
106 } 116 /* Handle to the peer core */
117 struct GNUNET_CORE_Handle *peer_handle;
118};
119
120static struct PeerContext *all_peers;
121
122struct TestMessageContext
123{
124 /* This is a linked list */
125 struct TestMessageContext *next;
126
127 /* Handle to the sending peer core */
128 struct GNUNET_CORE_Handle *peer1handle;
129
130 /* Handle to the receiving peer core */
131 struct GNUNET_CORE_Handle *peer2handle;
132
133 /* Handle to the sending peer daemon */
134 struct GNUNET_TESTING_Daemon *peer1;
135
136 /* Handle to the receiving peer daemon */
137 struct GNUNET_TESTING_Daemon *peer2;
107 138
108 if (p2.th != NULL) 139 /* Identifier for this message, so we don't disconnect other peers! */
140 uint32_t uid;
141
142 /* Task for disconnecting cores, allow task to be cancelled on shutdown */
143 GNUNET_SCHEDULER_TaskIdentifier disconnect_task;
144};
145
146static struct TestMessageContext *test_messages;
147
148static void
149finish_testing ()
150{
151 GNUNET_assert (pg != NULL);
152 struct PeerContext *peer_pos;
153 struct PeerContext *free_peer_pos;
154 struct TestMessageContext *pos;
155 struct TestMessageContext *free_pos;
156#if VERBOSE
157 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
158 "Called finish testing, stopping daemons.\n");
159#endif
160 peer_pos = all_peers;
161 while (peer_pos != NULL)
109 { 162 {
110 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transport 2!\n"); 163 fprintf(stderr, "Disconnecting from peer core\n");
111 GNUNET_TRANSPORT_disconnect (p2.th); 164 if (peer_pos->peer_handle != NULL)
112 p2.th = NULL; 165 GNUNET_CORE_disconnect(peer_pos->peer_handle);
166 free_peer_pos = peer_pos;
167 peer_pos = peer_pos->next;
168 GNUNET_free(free_peer_pos);
113 } 169 }
114 170
115 if (p3.th != NULL) 171 int count;
172 count = 0;
173 pos = test_messages;
174 while (pos != NULL)
116 { 175 {
117 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transport 3!\n"); 176 if (pos->peer1handle != NULL)
118 GNUNET_TRANSPORT_disconnect (p3.th); 177 {
119 p3.th = NULL; 178 GNUNET_CORE_disconnect(pos->peer1handle);
179 pos->peer1handle = NULL;
180 }
181 if (pos->peer2handle != NULL)
182 {
183 GNUNET_CORE_disconnect(pos->peer2handle);
184 pos->peer2handle = NULL;
185 }
186 free_pos = pos;
187 pos = pos->next;
188 if (free_pos->disconnect_task != GNUNET_SCHEDULER_NO_TASK)
189 {
190 GNUNET_SCHEDULER_cancel(sched, free_pos->disconnect_task);
191 }
192 GNUNET_free(free_pos);
120 } 193 }
194#if VERBOSE
195 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
196 "transmit_ready's scheduled %d, failed %d, transmit_ready's called %d\n", transmit_ready_scheduled, transmit_ready_failed, transmit_ready_called);
197#endif
121 198
122 if (p4.th != NULL) 199#if VERBOSE
200 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
201 "Calling daemons_stop\n");
202#endif
203 GNUNET_TESTING_daemons_stop (pg, TIMEOUT);
204#if VERBOSE
205 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
206 "daemons_stop finished\n");
207#endif
208 if (dotOutFile != NULL)
123 { 209 {
124 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transport 4!\n"); 210 fprintf(dotOutFile, "}");
125 GNUNET_TRANSPORT_disconnect (p4.th); 211 fclose(dotOutFile);
126 p4.th = NULL;
127 } 212 }
128 213
129 die_task = GNUNET_SCHEDULER_NO_TASK;
130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transports disconnected, returning success!\n");
131 sleep(2);
132 ok = 0; 214 ok = 0;
133} 215}
134 216
217
135static void 218static void
136stop_arm (struct PeerContext *p) 219disconnect_cores (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
137{ 220{
138#if START_ARM 221 struct TestMessageContext *pos = cls;
139 p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", 222
140 "gnunet-arm", 223 /* Disconnect from the respective cores */
141#if VERBOSE 224#if VERBOSE
142 "-L", "DEBUG", 225 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
226 "Disconnecting from peer 1 `%4s'\n", GNUNET_i2s (&pos->peer1->id));
143#endif 227#endif
144 "-c", p->cfg_file, "-e", "-q", NULL); 228 if (pos->peer1handle != NULL)
145 229 GNUNET_CORE_disconnect(pos->peer1handle);
146 GNUNET_OS_process_wait (p->arm_pid); 230#if VERBOSE
231 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
232 "Disconnecting from peer 2 `%4s'\n", GNUNET_i2s (&pos->peer2->id));
147#endif 233#endif
148 GNUNET_CONFIGURATION_destroy (p->cfg); 234 if (pos->peer2handle != NULL)
235 GNUNET_CORE_disconnect(pos->peer2handle);
236 /* Set handles to NULL so test case can be ended properly */
237 pos->peer1handle = NULL;
238 pos->peer2handle = NULL;
239 pos->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
240 /* Decrement total connections so new can be established */
241 total_server_connections -= 2;
149} 242}
150 243
151
152static void 244static void
153restart_transport (struct PeerContext *p) 245send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
154{ 246{
155#if START_ARM 247 die_task = GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 25), &finish_testing, NULL);
156 p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm",
157 "gnunet-arm",
158#if VERBOSE
159 "-L", "DEBUG",
160#endif
161 "-c", p->cfg_file, "-k", "transport", "-q", NULL);
162
163 GNUNET_OS_process_wait (p->arm_pid);
164#endif
165
166#if START_ARM
167 p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm",
168 "gnunet-arm",
169#if VERBOSE
170 "-L", "DEBUG",
171#endif
172 "-c", p->cfg_file, "-i", "transport", "-q", NULL);
173
174 GNUNET_OS_process_wait (p->arm_pid);
175#endif
176} 248}
177 249
178 250static int
179static void 251process_mtype (void *cls,
180end_badly () 252 const struct GNUNET_PeerIdentity *peer,
253 const struct GNUNET_MessageHeader *message,
254 struct GNUNET_TIME_Relative latency,
255 uint32_t distance)
181{ 256{
182 /* do work here */ 257 struct TestMessageContext *pos = cls;
258 struct GNUNET_TestMessage *msg = (struct GNUNET_TestMessage *)message;
259 if (pos->uid != ntohl(msg->uid))
260 return GNUNET_OK;
261
262 total_messages_received++;
183#if VERBOSE 263#if VERBOSE
184 fprintf(stderr, "Ending on an unhappy note.\n"); 264 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
265 "Received message from `%4s', type %d, distance %u.\n", GNUNET_i2s (peer), ntohs(message->type), distance);
266 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
267 "Total messages received %d, expected %d.\n", total_messages_received, expected_messages);
185#endif 268#endif
186 269
187 if (p1.th != NULL) 270 if (total_messages_received == expected_messages)
188 {
189 GNUNET_TRANSPORT_disconnect (p1.th);
190 p1.th = NULL;
191 }
192
193 if (p2.th != NULL)
194 { 271 {
195 GNUNET_TRANSPORT_disconnect (p2.th); 272 GNUNET_SCHEDULER_cancel (sched, die_task);
196 p2.th = NULL; 273 GNUNET_SCHEDULER_add_now (sched, &send_other_messages, NULL);
197 } 274 }
198 275 else
199 if (p3.th != NULL)
200 { 276 {
201 GNUNET_TRANSPORT_disconnect (p3.th); 277 pos->disconnect_task = GNUNET_SCHEDULER_add_now(sched, &disconnect_cores, pos);
202 p3.th = NULL;
203 } 278 }
204 279
205 if (p4.th != NULL) 280 return GNUNET_OK;
206 {
207 GNUNET_TRANSPORT_disconnect (p4.th);
208 p4.th = NULL;
209 }
210 sleep(2);
211 ok = 1;
212 return;
213} 281}
214 282
215static void 283static void
216notify_receive (void *cls, 284end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
217 const struct GNUNET_PeerIdentity *peer,
218 const struct GNUNET_MessageHeader *message,
219 struct GNUNET_TIME_Relative latency,
220 uint32_t distance)
221{ 285{
222 if (ntohs(message->type) != MTYPE) 286 char *msg = cls;
223 return; 287 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
224 288 "End badly was called (%s)... stopping daemons.\n", msg);
225 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received message of type %d from peer (%p) distance %d latency %u!\n", 289 struct TestMessageContext *pos;
226 ntohs(message->type), cls, distance, latency.value); 290 struct TestMessageContext *free_pos;
291
292 pos = test_messages;
293 while (pos != NULL)
294 {
295 if (pos->peer1handle != NULL)
296 {
297 GNUNET_CORE_disconnect(pos->peer1handle);
298 pos->peer1handle = NULL;
299 }
300 if (pos->peer2handle != NULL)
301 {
302 GNUNET_CORE_disconnect(pos->peer2handle);
303 pos->peer2handle = NULL;
304 }
305 free_pos = pos;
306 pos = pos->next;
307 GNUNET_free(free_pos);
308 }
227 309
228 GNUNET_assert (MTYPE == ntohs (message->type)); 310 if (pg != NULL)
229 GNUNET_assert (sizeof (struct GNUNET_MessageHeader) == 311 {
230 ntohs (message->size)); 312 GNUNET_TESTING_daemons_stop (pg, TIMEOUT);
231 num_received++; 313 ok = 7331; /* Opposite of leet */
232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %d of %d messages.\n", num_received, num_wanted); 314 }
315 else
316 ok = 401; /* Never got peers started */
233 317
234 if (num_wanted == num_received) 318 if (dotOutFile != NULL)
235 { 319 {
236 end (); 320 fprintf(dotOutFile, "}");
321 fclose(dotOutFile);
237 } 322 }
238} 323}
239 324
240
241static size_t 325static size_t
242notify_ready (void *cls, size_t size, void *buf) 326transmit_ready (void *cls, size_t size, void *buf)
243{ 327{
244 struct GNUNET_MessageHeader *hdr; 328 struct GNUNET_TestMessage *m;
245 329 struct TestMessageContext *pos = cls;
330
331 GNUNET_assert (buf != NULL);
332 m = (struct GNUNET_TestMessage *) buf;
333 m->header.type = htons (MTYPE);
334 m->header.size = htons (sizeof (struct GNUNET_TestMessage));
335 m->uid = htonl(pos->uid);
336 transmit_ready_called++;
337#if VERBOSE
246 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 338 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
247 "Transmitting message to peer (%p) - %u!\n", cls, size); 339 "transmit ready for peer %s\ntransmit_ready's scheduled %d, transmit_ready's called %d\n", GNUNET_i2s(&pos->peer1->id), transmit_ready_scheduled, transmit_ready_called);
248 GNUNET_assert (size >= 256); 340#endif
341 return sizeof (struct GNUNET_TestMessage);
342}
249 343
250 if (buf != NULL)
251 {
252 hdr = buf;
253 hdr->size = htons (sizeof (struct GNUNET_MessageHeader));
254 hdr->type = htons (MTYPE);
255 }
256 344
257 return sizeof (struct GNUNET_MessageHeader); 345static struct GNUNET_CORE_MessageHandler no_handlers[] = {
258} 346 {NULL, 0, 0}
347};
259 348
349static struct GNUNET_CORE_MessageHandler handlers[] = {
350 {&process_mtype, MTYPE, sizeof (struct GNUNET_TestMessage)},
351 {NULL, 0, 0}
352};
260 353
261static void 354static void
262notify_connect (void *cls, 355init_notify_peer2 (void *cls,
263 const struct GNUNET_PeerIdentity *peer, 356 struct GNUNET_CORE_Handle *server,
264 struct GNUNET_TIME_Relative latency, 357 const struct GNUNET_PeerIdentity *my_identity,
265 uint32_t distance) 358 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
266{ 359{
267 int peer_num = 0; 360 struct TestMessageContext *pos = cls;
268 int connect_num = 0;
269 struct PeerContext *from_peer = cls;
270 char *from_peer_str;
271
272 if (cls == &p1)
273 peer_num = 1;
274 else if (cls == &p2)
275 peer_num = 2;
276 else if (cls == &p3)
277 peer_num = 3;
278 else if (cls == &p4)
279 peer_num = 4;
280
281 if (memcmp(peer, &p1.id, sizeof(struct GNUNET_PeerIdentity)) == 0)
282 connect_num = 1;
283 else if (memcmp(peer, &p2.id, sizeof(struct GNUNET_PeerIdentity)) == 0)
284 connect_num = 2;
285 else if (memcmp(peer, &p3.id, sizeof(struct GNUNET_PeerIdentity)) == 0)
286 connect_num = 3;
287 else if (memcmp(peer, &p4.id, sizeof(struct GNUNET_PeerIdentity)) == 0)
288 connect_num = 4;
289 else
290 connect_num = -1;
291 361
292 if ((cls == &p1) && (memcmp(peer, &p3.id, sizeof(struct GNUNET_PeerIdentity)) == 0)) 362#if VERBOSE
363 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
364 "Core connection to `%4s' established, scheduling message send\n",
365 GNUNET_i2s (my_identity));
366#endif
367 total_server_connections++;
368
369 if (NULL == GNUNET_CORE_notify_transmit_ready (pos->peer1handle,
370 0,
371 TIMEOUT,
372 &pos->peer2->id,
373 sizeof (struct GNUNET_TestMessage),
374 &transmit_ready, pos))
293 { 375 {
294 GNUNET_TRANSPORT_notify_transmit_ready (p1.th, 376 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
295 &p3.id, 377 "RECEIVED NULL when asking core (1) for transmission to peer `%4s'\n",
296 256, 0, TIMEOUT, &notify_ready, 378 GNUNET_i2s (&pos->peer2->id));
297 &p1); 379 transmit_ready_failed++;
298 } 380 }
299 381 else
300 if ((cls == &p4) && (memcmp(peer, &p1.id, sizeof(struct GNUNET_PeerIdentity)) == 0))
301 { 382 {
302 383 transmit_ready_scheduled++;
303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
304 "Peer 4 notified about connection to peer 1, distance %u!\n", distance);
305
306 GNUNET_TRANSPORT_notify_transmit_ready (p4.th,
307 &p1.id,
308 256, 0, TIMEOUT, &notify_ready,
309 &p4);
310 } 384 }
311
312 GNUNET_asprintf(&from_peer_str, "%s", GNUNET_i2s(&from_peer->id));
313 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
314 "Peer `%d' %4s connected to peer `%d' %4s distance %d!\n", peer_num, from_peer_str, connect_num, GNUNET_i2s(peer), distance);
315} 385}
316 386
317 387
318static void 388static void
319notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) 389init_notify_peer1 (void *cls,
390 struct GNUNET_CORE_Handle *server,
391 const struct GNUNET_PeerIdentity *my_identity,
392 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
320{ 393{
394 struct TestMessageContext *pos = cls;
395 total_server_connections++;
396
397#if VERBOSE
321 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 398 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
322 "Peer `%4s' disconnected (%p)!\n", 399 "Core connection to `%4s' established, setting up handles\n",
323 GNUNET_i2s (peer), cls); 400 GNUNET_i2s (my_identity));
401#endif
402
403 /*
404 * Connect to the receiving peer
405 */
406 pos->peer2handle = GNUNET_CORE_connect (sched,
407 pos->peer2->cfg,
408 TIMEOUT,
409 pos,
410 &init_notify_peer2,
411 NULL,
412 NULL,
413 NULL,
414 GNUNET_YES, NULL, GNUNET_YES, handlers);
415
324} 416}
325 417
326 418
327static void 419static void
328setup_peer (struct PeerContext *p, const char *cfgname) 420send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
329{ 421{
330 p->cfg = GNUNET_CONFIGURATION_create (); 422 struct TestMessageContext *pos = cls;
331 p->cfg_file = strdup(cfgname); 423
332#if START_ARM 424 if ((tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN) || (cls == NULL))
333 p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", 425 return;
334 "gnunet-arm",
335#if VERBOSE_ARM
336 "-L", "DEBUG",
337#endif
338 "-c", cfgname, "-s", "-q", NULL);
339#endif
340 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
341}
342 426
427 if (die_task == GNUNET_SCHEDULER_NO_TASK)
428 {
429 die_task = GNUNET_SCHEDULER_add_delayed (sched,
430 TEST_TIMEOUT,
431 &end_badly, "from create topology (timeout)");
432 }
343 433
344static void blacklist_peer(struct GNUNET_DISK_FileHandle *file, struct PeerContext *peer) 434 if (total_server_connections >= MAX_OUTSTANDING_CONNECTIONS)
345{ 435 {
346 struct GNUNET_CRYPTO_HashAsciiEncoded peer_enc; 436 GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
347 char *buf; 437 &send_test_messages, pos);
348 size_t size; 438 return; /* Otherwise we'll double schedule messages here! */
349 439 }
350 GNUNET_CRYPTO_hash_to_enc(&peer->id.hashPubKey, &peer_enc); 440
351 size = GNUNET_asprintf(&buf, "%s:%s\n", "tcp", (char *)&peer_enc); 441 /*
352 GNUNET_DISK_file_write(file, buf, size); 442 * Connect to the sending peer
353 GNUNET_free_non_null(buf); 443 */
444 pos->peer1handle = GNUNET_CORE_connect (sched,
445 pos->peer1->cfg,
446 TIMEOUT,
447 pos,
448 &init_notify_peer1,
449 NULL,
450 NULL,
451 NULL,
452 GNUNET_NO, NULL, GNUNET_NO, no_handlers);
453
454 GNUNET_assert(pos->peer1handle != NULL);
455
456 if (total_server_connections < MAX_OUTSTANDING_CONNECTIONS)
457 {
458 GNUNET_SCHEDULER_add_now (sched,
459 &send_test_messages, pos->next);
460 }
461 else
462 {
463 GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
464 &send_test_messages, pos->next);
465 }
354} 466}
355 467
356static void
357setup_blacklists (void *cls,
358 const struct GNUNET_SCHEDULER_TaskContext *tc)
359{
360 char *blacklist_filename;
361 struct GNUNET_DISK_FileHandle *file;
362 int i;
363 468
364 for (i = 1; i <= 4; i++) 469void
470topology_callback (void *cls,
471 const struct GNUNET_PeerIdentity *first,
472 const struct GNUNET_PeerIdentity *second,
473 uint32_t distance,
474 const struct GNUNET_CONFIGURATION_Handle *first_cfg,
475 const struct GNUNET_CONFIGURATION_Handle *second_cfg,
476 struct GNUNET_TESTING_Daemon *first_daemon,
477 struct GNUNET_TESTING_Daemon *second_daemon,
478 const char *emsg)
479{
480 struct TestMessageContext *temp_context;
481 if (emsg == NULL)
365 { 482 {
366 GNUNET_asprintf(&blacklist_filename, "/tmp/test-gnunetd-transport-peer-%d/blacklist", i); 483 total_connections++;
367 if (blacklist_filename != NULL) 484#if VERBOSE
485 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connected peer %s to peer %s, distance %u\n",
486 first_daemon->shortname,
487 second_daemon->shortname,
488 distance);
489#endif
490 temp_context = GNUNET_malloc(sizeof(struct TestMessageContext));
491 temp_context->peer1 = first_daemon;
492 temp_context->peer2 = second_daemon;
493 temp_context->next = test_messages;
494 temp_context->uid = total_connections;
495 temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
496 test_messages = temp_context;
497
498 expected_messages++;
499 /*if (dotOutFile != NULL)
368 { 500 {
369 file = GNUNET_DISK_file_open(blacklist_filename, GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_TRUNCATE | GNUNET_DISK_OPEN_CREATE, 501 if (distance == 1)
370 GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); 502 fprintf(dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname, second_daemon->shortname);
371 GNUNET_free(blacklist_filename); 503 else if (distance == 2)
372 504 fprintf(dotOutFile, "\tn%s -- n%s [color=blue];\n", first_daemon->shortname, second_daemon->shortname);
373 if (file == NULL) 505 else if (distance == 3)
374 { 506 fprintf(dotOutFile, "\tn%s -- n%s [color=red];\n", first_daemon->shortname, second_daemon->shortname);
375 GNUNET_SCHEDULER_cancel(sched, die_task);
376 GNUNET_SCHEDULER_add_now(sched, &end_badly, NULL);
377 return;
378 }
379 switch (i)
380 {
381 case 1:
382 blacklist_peer(file, &p3);
383 blacklist_peer(file, &p4);
384 break;
385 case 2:
386 blacklist_peer(file, &p4);
387 break;
388 case 3:
389 blacklist_peer(file, &p1);
390 break;
391 case 4:
392 blacklist_peer(file, &p1);
393 blacklist_peer(file, &p2);
394 break;
395 }
396 } 507 }
508 */
397 } 509 }
510#if VERBOSE
511 else
512 {
513 failed_connections++;
514 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to connect peer %s to peer %s with error :\n%s\n",
515 first_daemon->shortname,
516 second_daemon->shortname, emsg);
517 }
518#endif
398 519
399 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 520 if (total_connections == expected_connections)
400 "Disconnecting transports...\n"); 521 {
522#if VERBOSE
523 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
524 "Created %d total connections, which is our target number! Calling send messages.\n",
525 total_connections);
526#endif
401 527
402 if (p1.th != NULL) 528 GNUNET_SCHEDULER_cancel (sched, die_task);
529 die_task = GNUNET_SCHEDULER_NO_TASK;
530 GNUNET_SCHEDULER_add_now (sched, &send_test_messages, test_messages);
531 //GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1), &send_test_messages, test_messages);
532 }
533 else if (total_connections + failed_connections == expected_connections)
403 { 534 {
404 GNUNET_TRANSPORT_disconnect (p1.th); 535 if (failed_connections < (unsigned int)(fail_percentage * total_connections))
405 p1.th = NULL; 536 {
537 GNUNET_SCHEDULER_cancel (sched, die_task);
538 die_task = GNUNET_SCHEDULER_NO_TASK;
539 GNUNET_SCHEDULER_add_now (sched, &send_test_messages, test_messages);
540 //GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1), &send_test_messages, test_messages);
541 }
542 else
543 {
544 GNUNET_SCHEDULER_cancel (sched, die_task);
545 die_task = GNUNET_SCHEDULER_add_now (sched,
546 &end_badly, "from topology_callback (too many failed connections)");
547 }
406 } 548 }
407 549 else
408 if (p2.th != NULL)
409 { 550 {
410 GNUNET_TRANSPORT_disconnect (p2.th); 551#if VERBOSE
411 p2.th = NULL; 552 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
553 "Have %d total connections, %d failed connections, Want %d (at least %d)\n",
554 total_connections, failed_connections, expected_connections, expected_connections - (unsigned int)(fail_percentage * expected_connections));
555#endif
412 } 556 }
557}
413 558
414 if (p3.th != NULL) 559static void
560connect_topology ()
561{
562 expected_connections = -1;
563 if ((pg != NULL) && (peers_left == 0))
415 { 564 {
416 GNUNET_TRANSPORT_disconnect (p3.th); 565 expected_connections = GNUNET_TESTING_connect_topology (pg, connection_topology, connect_topology_option, connect_topology_option_modifier);
417 p3.th = NULL; 566#if VERBOSE
567 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
568 "Have %d expected connections\n", expected_connections);
569#endif
418 } 570 }
419 571
420 if (p4.th != NULL) 572 GNUNET_SCHEDULER_cancel (sched, die_task);
573 if (expected_connections == GNUNET_SYSERR)
421 { 574 {
422 GNUNET_TRANSPORT_disconnect (p4.th); 575 die_task = GNUNET_SCHEDULER_add_now (sched,
423 p4.th = NULL; 576 &end_badly, "from connect topology (bad return)");
424 } 577 }
425 578
426 sleep(1); 579 die_task = GNUNET_SCHEDULER_add_delayed (sched,
427 580 TEST_TIMEOUT,
428 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 581 &end_badly, "from connect topology (timeout)");
429 "Restarting transport service (%p) with gnunet-arm -c %s -L DEBUG -k transport!\n", p1.arm_pid, p1.cfg_file);
430 restart_transport(&p1);
431
432 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
433 "Restarting transport service (%p) with gnunet-arm -c %s -L DEBUG -k transport!\n", p2.arm_pid, p2.cfg_file);
434 restart_transport(&p2);
435
436 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
437 "Restarting transport service (%p) with gnunet-arm -c %s -L DEBUG -k transport!\n", p3.arm_pid, p3.cfg_file);
438 restart_transport(&p3);
439
440 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
441 "Restarting transport service (%p) with gnunet-arm -c %s -L DEBUG -k transport!\n", p4.arm_pid, p4.cfg_file);
442 restart_transport(&p4);
443
444 p1.th = GNUNET_TRANSPORT_connect (sched, p1.cfg,
445 &p1,
446 &notify_receive,
447 &notify_connect, &notify_disconnect);
448
449 p2.th = GNUNET_TRANSPORT_connect (sched, p2.cfg,
450 &p2,
451 &notify_receive,
452 &notify_connect, &notify_disconnect);
453
454 p3.th = GNUNET_TRANSPORT_connect (sched, p3.cfg,
455 &p3,
456 &notify_receive,
457 &notify_connect, &notify_disconnect);
458
459 p4.th = GNUNET_TRANSPORT_connect (sched, p4.cfg,
460 &p4,
461 &notify_receive,
462 &notify_connect, &notify_disconnect);
463 GNUNET_assert(p1.th != NULL);
464 GNUNET_assert(p2.th != NULL);
465 GNUNET_assert(p3.th != NULL);
466 GNUNET_assert(p4.th != NULL);
467
468 GNUNET_TRANSPORT_offer_hello (p1.th, GNUNET_HELLO_get_header(p2.hello));
469 GNUNET_TRANSPORT_offer_hello (p2.th, GNUNET_HELLO_get_header(p3.hello));
470 GNUNET_TRANSPORT_offer_hello (p3.th, GNUNET_HELLO_get_header(p4.hello));
471
472} 582}
473 583
474
475static void 584static void
476get_hello_fourth (void *cls, 585create_topology ()
477 const struct GNUNET_MessageHeader *message)
478{ 586{
479 struct PeerContext *me = cls; 587 peers_left = num_peers; /* Reset counter */
480 588 if (GNUNET_TESTING_create_topology (pg, topology, blacklist_topology, blacklist_transports) != GNUNET_SYSERR)
481 GNUNET_TRANSPORT_get_hello_cancel (me->th, &get_hello_fourth, me); 589 {
482 590#if VERBOSE
483 GNUNET_assert (message != NULL); 591 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
484 GNUNET_assert (GNUNET_OK == 592 "Topology set up, now starting peers!\n");
485 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) 593#endif
486 message, &me->id)); 594 GNUNET_TESTING_daemons_continue_startup(pg);
487 595 }
488 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 596 else
489 "Received HELLO size %d\n", GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 597 {
490 598 GNUNET_SCHEDULER_cancel (sched, die_task);
491 me->hello = GNUNET_malloc(GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 599 die_task = GNUNET_SCHEDULER_add_now (sched,
492 memcpy(me->hello, message, GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 600 &end_badly, "from create topology (bad return)");
601 }
602 GNUNET_SCHEDULER_cancel (sched, die_task);
603 die_task = GNUNET_SCHEDULER_add_delayed (sched,
604 TEST_TIMEOUT,
605 &end_badly, "from continue startup (timeout)");
606}
493 607
494 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 608/**
495 "All HELLO's received, setting up blacklists!\n"); 609 * Method called whenever a given peer connects.
610 *
611 * @param cls closure
612 * @param peer peer identity this notification is about
613 * @param latency reported latency of the connection with 'other'
614 * @param distance reported distance (DV) to 'other'
615 */
616static void all_connect_handler (void *cls,
617 const struct
618 GNUNET_PeerIdentity * peer,
619 struct GNUNET_TIME_Relative latency,
620 uint32_t distance)
621{
622 struct GNUNET_TESTING_Daemon *d = cls;
623 char *second_shortname = strdup(GNUNET_i2s(peer));
496 624
497 GNUNET_SCHEDULER_add_now(sched, &setup_blacklists, NULL); 625#if VERBOSE
626 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "connected peer %s to peer %s, distance %u\n",
627 d->shortname,
628 second_shortname,
629 distance);
630#endif
631 /*temp_context = GNUNET_malloc(sizeof(struct TestMessageContext));
632 temp_context->peer1 = first_daemon;
633 temp_context->peer2 = second_daemon;
634 temp_context->next = test_messages;
635 temp_context->uid = total_connections;
636 temp_context->disconnect_task = GNUNET_SCHEDULER_NO_TASK;
637 test_messages = temp_context;*/
638
639 if (dotOutFile != NULL)
640 {
641 if (distance == 1)
642 fprintf(dotOutFile, "\tn%s -- n%s;\n", d->shortname, second_shortname);
643 else if (distance == 2)
644 fprintf(dotOutFile, "\tn%s -- n%s [color=blue];\n", d->shortname, second_shortname);
645 else if (distance == 3)
646 fprintf(dotOutFile, "\tn%s -- n%s [color=red];\n", d->shortname, second_shortname);
647 }
648 GNUNET_free(second_shortname);
498} 649}
499 650
500
501static void 651static void
502get_hello_third (void *cls, 652peers_started_callback (void *cls,
503 const struct GNUNET_MessageHeader *message) 653 const struct GNUNET_PeerIdentity *id,
654 const struct GNUNET_CONFIGURATION_Handle *cfg,
655 struct GNUNET_TESTING_Daemon *d, const char *emsg)
504{ 656{
505 struct PeerContext *me = cls; 657 struct PeerContext *new_peer;
506 658 if (emsg != NULL)
507 GNUNET_TRANSPORT_get_hello_cancel (me->th, &get_hello_third, me); 659 {
508 660 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to start daemon with error: `%s'\n",
509 GNUNET_assert (message != NULL); 661 emsg);
510 GNUNET_assert (GNUNET_OK == 662 return;
511 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) 663 }
512 message, &me->id)); 664 GNUNET_assert (id != NULL);
665#if VERBOSE
666 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n",
667 (num_peers - peers_left) + 1, num_peers);
668#endif
669 new_peer = GNUNET_malloc(sizeof(struct PeerContext));
670 new_peer->peer_handle = GNUNET_CORE_connect(sched, cfg, GNUNET_TIME_UNIT_FOREVER_REL, d, NULL, &all_connect_handler, NULL, NULL, GNUNET_NO, NULL, GNUNET_NO, no_handlers);
671 new_peer->next = all_peers;
672 all_peers = new_peer;
673 peers_left--;
513 674
514 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 675 if (peers_left == 0)
515 "Received HELLO size %d\n", GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 676 {
677#if VERBOSE
678 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
679 "All %d daemons started, now creating topology!\n",
680 num_peers);
681#endif
682 GNUNET_SCHEDULER_cancel (sched, die_task);
683 /* Set up task in case topology creation doesn't finish
684 * within a reasonable amount of time */
685 die_task = GNUNET_SCHEDULER_add_delayed (sched,
686 GNUNET_TIME_relative_multiply
687 (GNUNET_TIME_UNIT_MINUTES, 5),
688 &end_badly, "from peers_started_callback");
689
690 connect_topology ();
691 ok = 0;
692 }
693}
516 694
517 me->hello = GNUNET_malloc(GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 695/**
518 memcpy(me->hello, message, GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 696 * Callback indicating that the hostkey was created for a peer.
697 *
698 * @param cls NULL
699 * @param id the peer identity
700 * @param d the daemon handle (pretty useless at this point, remove?)
701 * @param emsg non-null on failure
702 */
703void hostkey_callback (void *cls,
704 const struct GNUNET_PeerIdentity *id,
705 struct GNUNET_TESTING_Daemon *d,
706 const char *emsg)
707{
708 if (emsg != NULL)
709 {
710 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Hostkey callback received error: %s\n", emsg);
711 }
519 712
520 GNUNET_TRANSPORT_get_hello (p4.th, &get_hello_fourth, &p4); 713#if VERBOSE
714 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
715 "Hostkey created for peer `%s'\n",
716 GNUNET_i2s(id));
717#endif
718 peers_left--;
719 if (peers_left == 0)
720 {
721#if VERBOSE
722 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
723 "All %d hostkeys created, now creating topology!\n",
724 num_peers);
725#endif
726 GNUNET_SCHEDULER_cancel (sched, die_task);
727 /* Set up task in case topology creation doesn't finish
728 * within a reasonable amount of time */
729 die_task = GNUNET_SCHEDULER_add_delayed (sched,
730 GNUNET_TIME_relative_multiply
731 (GNUNET_TIME_UNIT_MINUTES, 5),
732 &end_badly, "from hostkey_callback");
733 GNUNET_SCHEDULER_add_now(sched, &create_topology, NULL);
734 ok = 0;
735 }
521} 736}
522 737
523
524static void 738static void
525get_hello_second (void *cls, 739run (void *cls,
526 const struct GNUNET_MessageHeader *message) 740 struct GNUNET_SCHEDULER_Handle *s,
741 char *const *args,
742 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
527{ 743{
528 struct PeerContext *me = cls; 744 char * topology_str;
529 745 char * connect_topology_str;
530 GNUNET_TRANSPORT_get_hello_cancel (me->th, &get_hello_second, me); 746 char * blacklist_topology_str;
747 char * connect_topology_option_str;
748 char * connect_topology_option_modifier_string;
749 sched = s;
750 ok = 1;
531 751
532 GNUNET_assert (message != NULL); 752 dotOutFile = fopen (dotOutFileName, "w");
533 GNUNET_assert (GNUNET_OK == 753 if (dotOutFile != NULL)
534 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) 754 {
535 message, &me->id)); 755 fprintf (dotOutFile, "strict graph G {\n");
756 }
536 757
758#if VERBOSE
537 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 759 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
538 "Received HELLO size %d\n", GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 760 "Starting daemons based on config file %s\n", cfgfile);
761#endif
539 762
540 me->hello = GNUNET_malloc(GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 763 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_string(cfg, "paths", "servicehome", &test_directory))
541 memcpy(me->hello, message, GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 764 {
765 ok = 404;
766 return;
767 }
542 768
543 GNUNET_TRANSPORT_get_hello (p3.th, &get_hello_third, &p3); 769 if ((GNUNET_YES ==
544} 770 GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "topology",
771 &topology_str)) && (GNUNET_NO == GNUNET_TESTING_topology_get(&topology, topology_str)))
772 {
773 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
774 "Invalid topology `%s' given for section %s option %s\n", topology_str, "TESTING", "TOPOLOGY");
775 topology = GNUNET_TESTING_TOPOLOGY_CLIQUE; /* Defaults to NONE, so set better default here */
776 }
545 777
778 if ((GNUNET_YES ==
779 GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "connect_topology",
780 &connect_topology_str)) && (GNUNET_NO == GNUNET_TESTING_topology_get(&connection_topology, connect_topology_str)))
781 {
782 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
783 "Invalid connect topology `%s' given for section %s option %s\n", connect_topology_str, "TESTING", "CONNECT_TOPOLOGY");
784 }
546 785
547static void 786 if ((GNUNET_YES ==
548get_hello_first (void *cls, 787 GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "connect_topology_option",
549 const struct GNUNET_MessageHeader *message) 788 &connect_topology_option_str)) && (GNUNET_NO == GNUNET_TESTING_topology_option_get(&connect_topology_option, connect_topology_option_str)))
550{ 789 {
551 struct PeerContext *me = cls; 790 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
791 "Invalid connect topology option `%s' given for section %s option %s\n", connect_topology_option_str, "TESTING", "CONNECT_TOPOLOGY_OPTION");
792 connect_topology_option = GNUNET_TESTING_TOPOLOGY_OPTION_ALL; /* Defaults to NONE, set to ALL */
793 }
552 794
553 GNUNET_TRANSPORT_get_hello_cancel (me->th, &get_hello_first, me); 795 if (GNUNET_YES ==
796 GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "connect_topology_option_modifier",
797 &connect_topology_option_modifier_string))
798 {
799 if (sscanf(connect_topology_option_modifier_string, "%lf", &connect_topology_option_modifier) != 1)
800 {
801 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
802 _("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
803 connect_topology_option_modifier_string,
804 "connect_topology_option_modifier",
805 "TESTING");
806 }
807 GNUNET_free (connect_topology_option_modifier_string);
808 }
554 809
555 GNUNET_assert (message != NULL); 810 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "blacklist_transports",
556 GNUNET_assert (GNUNET_OK == 811 &blacklist_transports))
557 GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) 812 blacklist_transports = NULL;
558 message, &me->id));
559 813
560 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 814 if ((GNUNET_YES ==
561 "Received HELLO size %d\n", GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 815 GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "blacklist_topology",
816 & blacklist_topology_str)) && (GNUNET_NO == GNUNET_TESTING_topology_get(&blacklist_topology, blacklist_topology_str)))
817 {
818 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
819 "Invalid topology `%s' given for section %s option %s\n", topology_str, "TESTING", "BLACKLIST_TOPOLOGY");
820 }
562 821
563 me->hello = GNUNET_malloc(GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 822 if (GNUNET_SYSERR ==
564 memcpy(me->hello, message, GNUNET_HELLO_size((const struct GNUNET_HELLO_Message *)message)); 823 GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers",
824 &num_peers))
825 num_peers = DEFAULT_NUM_PEERS;
565 826
566 GNUNET_TRANSPORT_get_hello (p2.th, &get_hello_second, &p2); 827 main_cfg = cfg;
567}
568 828
569static void 829 peers_left = num_peers;
570run (void *cls,
571 struct GNUNET_SCHEDULER_Handle *s,
572 char *const *args,
573 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
574{
575 GNUNET_assert (ok == 1);
576 OKPP;
577 sched = s;
578 830
831 /* Set up a task to end testing if peer start fails */
579 die_task = GNUNET_SCHEDULER_add_delayed (sched, 832 die_task = GNUNET_SCHEDULER_add_delayed (sched,
580 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 5), &end_badly, NULL); 833 GNUNET_TIME_relative_multiply
581 834 (GNUNET_TIME_UNIT_MINUTES, 5),
582 setup_peer (&p1, "test_transport_api_dv_peer1.conf"); 835 &end_badly, "didn't start all daemons in reasonable amount of time!!!");
583 setup_peer (&p2, "test_transport_api_dv_peer2.conf"); 836
584 setup_peer (&p3, "test_transport_api_dv_peer3.conf"); 837 pg = GNUNET_TESTING_daemons_start (sched, cfg,
585 setup_peer (&p4, "test_transport_api_dv_peer4.conf"); 838 peers_left, TIMEOUT, &hostkey_callback, NULL, &peers_started_callback, NULL,
586 839 &topology_callback, NULL, NULL);
587 p1.th = GNUNET_TRANSPORT_connect (sched, p1.cfg, 840
588 &p1,
589 &notify_receive,
590 &notify_connect, &notify_disconnect);
591
592 p2.th = GNUNET_TRANSPORT_connect (sched, p2.cfg,
593 &p2,
594 &notify_receive,
595 &notify_connect, &notify_disconnect);
596
597 p3.th = GNUNET_TRANSPORT_connect (sched, p3.cfg,
598 &p3,
599 &notify_receive,
600 &notify_connect, &notify_disconnect);
601
602 p4.th = GNUNET_TRANSPORT_connect (sched, p4.cfg,
603 &p4,
604 &notify_receive,
605 &notify_connect, &notify_disconnect);
606 GNUNET_assert(p1.th != NULL);
607 GNUNET_assert(p2.th != NULL);
608 GNUNET_assert(p3.th != NULL);
609 GNUNET_assert(p4.th != NULL);
610
611 GNUNET_TRANSPORT_get_hello (p1.th, &get_hello_first, &p1);
612} 841}
613 842
614static int 843static int
615check () 844check ()
616{ 845{
617 846 int ret;
618 char *const argv[] = { "test-transport-api", 847 char *const argv[] = {"test-transport-dv",
619 "-c", 848 "-c",
620 "test_transport_api_data.conf", 849 "test_transport_dv_data.conf",
621#if VERBOSE 850#if VERBOSE
622 "-L", "DEBUG", 851 "-L", "DEBUG",
623#endif 852#endif
624 NULL 853 NULL
625 }; 854 };
626
627 struct GNUNET_GETOPT_CommandLineOption options[] = { 855 struct GNUNET_GETOPT_CommandLineOption options[] = {
628 GNUNET_GETOPT_OPTION_END 856 GNUNET_GETOPT_OPTION_END
629 }; 857 };
630 858 ret = GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
631 ok = 1; 859 argv, "test-transport-dv", "nohelp",
632 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
633 argv, "test-transport-api", "nohelp",
634 options, &run, &ok); 860 options, &run, &ok);
635 stop_arm (&p1); 861 if (ret != GNUNET_OK)
636 stop_arm (&p2); 862 {
637 stop_arm (&p3); 863 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "`test-transport-dv': Failed with error code %d\n", ret);
638 stop_arm (&p4); 864 }
639 return ok; 865 return ok;
640} 866}
641 867
642
643int 868int
644main (int argc, char *argv[]) 869main (int argc, char *argv[])
645{ 870{
646 int ret; 871 int ret;
647#ifdef MINGW
648 return GNUNET_SYSERR;
649#endif
650 872
651 GNUNET_log_setup ("test-transport-api-dv", 873 GNUNET_log_setup ("test-transport-dv",
652#if VERBOSE 874#if VERBOSE
653 "DEBUG", 875 "DEBUG",
654#else 876#else
@@ -656,12 +878,16 @@ main (int argc, char *argv[])
656#endif 878#endif
657 NULL); 879 NULL);
658 ret = check (); 880 ret = check ();
659 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-1"); 881
660 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-2"); 882 /**
661 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-3"); 883 * Need to remove base directory, subdirectories taken care
662 GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-transport-peer-4"); 884 * of by the testing framework.
885 */
886 if (GNUNET_DISK_directory_remove (test_directory) != GNUNET_OK)
887 {
888 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Failed to remove testing directory %s\n", test_directory);
889 }
663 return ret; 890 return ret;
664} 891}
665 892
666/* end of test_transport_api_dv.c */ 893/* end of test_testing_topology.c */
667
diff --git a/src/dv/test_transport_api_dv_peer1.conf b/src/dv/test_transport_api_dv_peer1.conf
index c919f78b0..af53414d4 100644
--- a/src/dv/test_transport_api_dv_peer1.conf
+++ b/src/dv/test_transport_api_dv_peer1.conf
@@ -1,28 +1,3 @@
1[fs]
2ACCEPT_FROM6 = ::1;
3ACCEPT_FROM = 127.0.0.1;
4BINARY = gnunet-service-fs
5CONFIG = $DEFAULTCONFIG
6HOME = $SERVICEHOME
7HOSTNAME = localhost
8PORT = 2094
9INDEXDB = $SERVICEHOME/idxinfo.lst
10
11[datastore-sqlite]
12FILENAME = $SERVICEHOME/datastore/sqlite.db
13
14[datastore]
15DATABASE = sqlite
16BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
17QUOTA = 100000000
18ACCEPT_FROM6 = ::1;
19ACCEPT_FROM = 127.0.0.1;
20BINARY = gnunet-service-datastore
21CONFIG = $DEFAULTCONFIG
22HOME = $SERVICEHOME
23HOSTNAME = localhost
24PORT = 2093
25
26[hostlist] 1[hostlist]
27HTTP-PROXY = 2HTTP-PROXY =
28SERVERS = http://gnunet.org:8080/ 3SERVERS = http://gnunet.org:8080/
@@ -57,6 +32,7 @@ HOME = $SERVICEHOME
57HOSTNAME = localhost 32HOSTNAME = localhost
58PORT = 12365 33PORT = 12365
59BLACKLIST_FILE = $SERVICEHOME/blacklist 34BLACKLIST_FILE = $SERVICEHOME/blacklist
35UNIXPATH = /tmp/gnunet-p1-service-transport.sock
60 36
61[peerinfo] 37[peerinfo]
62TRUST = $SERVICEHOME/data/credit/ 38TRUST = $SERVICEHOME/data/credit/
@@ -68,6 +44,7 @@ CONFIG = $DEFAULTCONFIG
68HOME = $SERVICEHOME 44HOME = $SERVICEHOME
69HOSTNAME = localhost 45HOSTNAME = localhost
70PORT = 12369 46PORT = 12369
47UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
71 48
72[resolver] 49[resolver]
73ACCEPT_FROM6 = ::1; 50ACCEPT_FROM6 = ::1;
@@ -77,6 +54,7 @@ CONFIG = $DEFAULTCONFIG
77HOME = $SERVICEHOME 54HOME = $SERVICEHOME
78HOSTNAME = localhost 55HOSTNAME = localhost
79PORT = 12364 56PORT = 12364
57UNIXPATH = /tmp/gnunet-p1-service-resolver.sock
80 58
81[statistics] 59[statistics]
82ACCEPT_FROM6 = ::1; 60ACCEPT_FROM6 = ::1;
@@ -86,6 +64,7 @@ CONFIG = $DEFAULTCONFIG
86HOME = $SERVICEHOME 64HOME = $SERVICEHOME
87HOSTNAME = localhost 65HOSTNAME = localhost
88PORT = 12367 66PORT = 12367
67UNIXPATH = /tmp/gnunet-p1-service-statistics.sock
89 68
90[dv] 69[dv]
91DEBUG = NO 70DEBUG = NO
@@ -110,6 +89,7 @@ CONFIG = $DEFAULTCONFIG
110HOME = $SERVICEHOME 89HOME = $SERVICEHOME
111HOSTNAME = localhost 90HOSTNAME = localhost
112PORT = 12092 91PORT = 12092
92UNIXPATH = /tmp/gnunet-p1-service-core.sock
113 93
114[arm] 94[arm]
115DEFAULTSERVICES = 95DEFAULTSERVICES =
@@ -120,6 +100,7 @@ CONFIG = $DEFAULTCONFIG
120HOME = $SERVICEHOME 100HOME = $SERVICEHOME
121HOSTNAME = localhost 101HOSTNAME = localhost
122PORT = 12366 102PORT = 12366
103UNIXPATH = /tmp/gnunet-p1-service-arm.sock
123 104
124[transport-tcp] 105[transport-tcp]
125TIMEOUT = 300000 106TIMEOUT = 300000
diff --git a/src/dv/test_transport_api_dv_peer2.conf b/src/dv/test_transport_api_dv_peer2.conf
index 31338d6e9..515f6340b 100644
--- a/src/dv/test_transport_api_dv_peer2.conf
+++ b/src/dv/test_transport_api_dv_peer2.conf
@@ -1,16 +1,3 @@
1[fs]
2ACCEPT_FROM6 = ::1;
3ACCEPT_FROM = 127.0.0.1;
4BINARY = gnunet-service-fs
5CONFIG = $DEFAULTCONFIG
6HOME = $SERVICEHOME
7HOSTNAME = localhost
8PORT = 2094
9INDEXDB = $SERVICEHOME/idxinfo.lst
10
11[datastore-sqlite]
12FILENAME = $SERVICEHOME/datastore/sqlite.db
13
14[core] 1[core]
15TOTAL_QUOTA_OUT = 3932160 2TOTAL_QUOTA_OUT = 3932160
16TOTAL_QUOTA_IN = 3932160 3TOTAL_QUOTA_IN = 3932160
@@ -22,18 +9,6 @@ HOME = $SERVICEHOME
22HOSTNAME = localhost 9HOSTNAME = localhost
23PORT = 22092 10PORT = 22092
24 11
25[datastore]
26DATABASE = sqlite
27BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
28QUOTA = 100000000
29ACCEPT_FROM6 = ::1;
30ACCEPT_FROM = 127.0.0.1;
31BINARY = gnunet-service-datastore
32CONFIG = $DEFAULTCONFIG
33HOME = $SERVICEHOME
34HOSTNAME = localhost
35PORT = 2093
36
37[hostlist] 12[hostlist]
38HTTP-PROXY = 13HTTP-PROXY =
39SERVERS = http://gnunet.org:8080/ 14SERVERS = http://gnunet.org:8080/
@@ -69,6 +44,7 @@ PORT = 22365
69#PREFIX = xterm -T transport1 -e gdb --command=cmd --args 44#PREFIX = xterm -T transport1 -e gdb --command=cmd --args
70#PREFIX = valgrind --leak-check=full 45#PREFIX = valgrind --leak-check=full
71BLACKLIST_FILE = $SERVICEHOME/blacklist 46BLACKLIST_FILE = $SERVICEHOME/blacklist
47UNIXPATH = /tmp/gnunet-p2-service-transport.sock
72 48
73[peerinfo] 49[peerinfo]
74TRUST = $SERVICEHOME/data/credit/ 50TRUST = $SERVICEHOME/data/credit/
@@ -80,6 +56,7 @@ CONFIG = $DEFAULTCONFIG
80HOME = $SERVICEHOME 56HOME = $SERVICEHOME
81HOSTNAME = localhost 57HOSTNAME = localhost
82PORT = 22369 58PORT = 22369
59UNIXPATH = /tmp/gnunet-p2-service-peerinfo.sock
83 60
84[resolver] 61[resolver]
85ACCEPT_FROM6 = ::1; 62ACCEPT_FROM6 = ::1;
@@ -89,6 +66,7 @@ CONFIG = $DEFAULTCONFIG
89HOME = $SERVICEHOME 66HOME = $SERVICEHOME
90HOSTNAME = localhost 67HOSTNAME = localhost
91PORT = 22364 68PORT = 22364
69UNIXPATH = /tmp/gnunet-p2-service-resolver.sock
92 70
93[statistics] 71[statistics]
94ACCEPT_FROM6 = ::1; 72ACCEPT_FROM6 = ::1;
@@ -98,6 +76,7 @@ CONFIG = $DEFAULTCONFIG
98HOME = $SERVICEHOME 76HOME = $SERVICEHOME
99HOSTNAME = localhost 77HOSTNAME = localhost
100PORT = 22367 78PORT = 22367
79UNIXPATH = /tmp/gnunet-p2-service-statistics.sock
101 80
102[dv] 81[dv]
103DEBUG = NO 82DEBUG = NO
@@ -121,6 +100,7 @@ CONFIG = $DEFAULTCONFIG
121HOME = $SERVICEHOME 100HOME = $SERVICEHOME
122HOSTNAME = localhost 101HOSTNAME = localhost
123PORT = 22366 102PORT = 22366
103UNIXPATH = /tmp/gnunet-p2-service-arm.sock
124 104
125[transport-tcp] 105[transport-tcp]
126TIMEOUT = 300000 106TIMEOUT = 300000
diff --git a/src/dv/test_transport_api_dv_peer3.conf b/src/dv/test_transport_api_dv_peer3.conf
index 83e8d81c6..be9d7fd2d 100644
--- a/src/dv/test_transport_api_dv_peer3.conf
+++ b/src/dv/test_transport_api_dv_peer3.conf
@@ -1,28 +1,3 @@
1[fs]
2ACCEPT_FROM6 = ::1;
3ACCEPT_FROM = 127.0.0.1;
4BINARY = gnunet-service-fs
5CONFIG = $DEFAULTCONFIG
6HOME = $SERVICEHOME
7HOSTNAME = localhost
8PORT = 2094
9INDEXDB = $SERVICEHOME/idxinfo.lst
10
11[datastore-sqlite]
12FILENAME = $SERVICEHOME/datastore/sqlite.db
13
14[datastore]
15DATABASE = sqlite
16BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
17QUOTA = 100000000
18ACCEPT_FROM6 = ::1;
19ACCEPT_FROM = 127.0.0.1;
20BINARY = gnunet-service-datastore
21CONFIG = $DEFAULTCONFIG
22HOME = $SERVICEHOME
23HOSTNAME = localhost
24PORT = 2093
25
26[hostlist] 1[hostlist]
27HTTP-PROXY = 2HTTP-PROXY =
28SERVERS = http://gnunet.org:8080/ 3SERVERS = http://gnunet.org:8080/
@@ -58,6 +33,7 @@ PORT = 32365
58#PREFIX = xterm -T transport1 -e gdb --args 33#PREFIX = xterm -T transport1 -e gdb --args
59#PREFIX = valgrind --leak-check=full 34#PREFIX = valgrind --leak-check=full
60BLACKLIST_FILE = $SERVICEHOME/blacklist 35BLACKLIST_FILE = $SERVICEHOME/blacklist
36UNIXPATH = /tmp/gnunet-p3-service-transport.sock
61 37
62[peerinfo] 38[peerinfo]
63TRUST = $SERVICEHOME/data/credit/ 39TRUST = $SERVICEHOME/data/credit/
@@ -78,6 +54,7 @@ CONFIG = $DEFAULTCONFIG
78HOME = $SERVICEHOME 54HOME = $SERVICEHOME
79HOSTNAME = localhost 55HOSTNAME = localhost
80PORT = 32364 56PORT = 32364
57UNIXPATH = /tmp/gnunet-p3-service-resolver.sock
81 58
82[core] 59[core]
83TOTAL_QUOTA_OUT = 3932160 60TOTAL_QUOTA_OUT = 3932160
@@ -89,6 +66,7 @@ CONFIG = $DEFAULTCONFIG
89HOME = $SERVICEHOME 66HOME = $SERVICEHOME
90HOSTNAME = localhost 67HOSTNAME = localhost
91PORT = 32092 68PORT = 32092
69UNIXPATH = /tmp/gnunet-p3-service-core.sock
92 70
93[statistics] 71[statistics]
94ACCEPT_FROM6 = ::1; 72ACCEPT_FROM6 = ::1;
@@ -98,6 +76,7 @@ CONFIG = $DEFAULTCONFIG
98HOME = $SERVICEHOME 76HOME = $SERVICEHOME
99HOSTNAME = localhost 77HOSTNAME = localhost
100PORT = 32367 78PORT = 32367
79UNIXPATH = /tmp/gnunet-p3-service-statistics.sock
101 80
102[dv] 81[dv]
103DEBUG = YES 82DEBUG = YES
@@ -121,6 +100,7 @@ CONFIG = $DEFAULTCONFIG
121HOME = $SERVICEHOME 100HOME = $SERVICEHOME
122HOSTNAME = localhost 101HOSTNAME = localhost
123PORT = 32366 102PORT = 32366
103UNIXPATH = /tmp/gnunet-p3-service-arm.sock
124 104
125[transport-tcp] 105[transport-tcp]
126TIMEOUT = 300000 106TIMEOUT = 300000
diff --git a/src/dv/test_transport_api_dv_peer4.conf b/src/dv/test_transport_api_dv_peer4.conf
index 4b569f62a..c051de030 100644
--- a/src/dv/test_transport_api_dv_peer4.conf
+++ b/src/dv/test_transport_api_dv_peer4.conf
@@ -24,6 +24,7 @@ PORT = 42365
24#PREFIX = xterm -T transport1 -e gdb --args 24#PREFIX = xterm -T transport1 -e gdb --args
25#PREFIX = valgrind --leak-check=full 25#PREFIX = valgrind --leak-check=full
26BLACKLIST_FILE = $SERVICEHOME/blacklist 26BLACKLIST_FILE = $SERVICEHOME/blacklist
27UNIXPATH = /tmp/gnunet-p4-service-transport.sock
27 28
28[peerinfo] 29[peerinfo]
29TRUST = $SERVICEHOME/data/credit/ 30TRUST = $SERVICEHOME/data/credit/
@@ -36,6 +37,7 @@ CONFIG = $DEFAULTCONFIG
36HOME = $SERVICEHOME 37HOME = $SERVICEHOME
37HOSTNAME = localhost 38HOSTNAME = localhost
38PORT = 42369 39PORT = 42369
40UNIXPATH = /tmp/gnunet-p4-service-peerinfo.sock
39 41
40[resolver] 42[resolver]
41ALLOW_SHUTDOWN = YES 43ALLOW_SHUTDOWN = YES
@@ -46,6 +48,7 @@ CONFIG = $DEFAULTCONFIG
46HOME = $SERVICEHOME 48HOME = $SERVICEHOME
47HOSTNAME = localhost 49HOSTNAME = localhost
48PORT = 42364 50PORT = 42364
51UNIXPATH = /tmp/gnunet-p4-service-resolver.sock
49 52
50[core] 53[core]
51TOTAL_QUOTA_OUT = 3932160 54TOTAL_QUOTA_OUT = 3932160
@@ -58,6 +61,7 @@ CONFIG = $DEFAULTCONFIG
58HOME = $SERVICEHOME 61HOME = $SERVICEHOME
59HOSTNAME = localhost 62HOSTNAME = localhost
60PORT = 42092 63PORT = 42092
64UNIXPATH = /tmp/gnunet-p4-service-core.sock
61 65
62[statistics] 66[statistics]
63ALLOW_SHUTDOWN = YES 67ALLOW_SHUTDOWN = YES
@@ -68,6 +72,7 @@ CONFIG = $DEFAULTCONFIG
68HOME = $SERVICEHOME 72HOME = $SERVICEHOME
69HOSTNAME = localhost 73HOSTNAME = localhost
70PORT = 42367 74PORT = 42367
75UNIXPATH = /tmp/gnunet-p4-service-statistics.sock
71 76
72[dv] 77[dv]
73DEBUG = NO 78DEBUG = NO
@@ -75,7 +80,7 @@ ALLOW_SHUTDOWN = YES
75ACCEPT_FROM6 = ::1; 80ACCEPT_FROM6 = ::1;
76ACCEPT_FROM = 127.0.0.1; 81ACCEPT_FROM = 127.0.0.1;
77BINARY = gnunet-service-dv 82BINARY = gnunet-service-dv
78BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/dv/.libs/gnunet-service-dv 83#BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/dv/.libs/gnunet-service-dv
79#PREFIX = xterm -T dvservice4 -e gdb --args 84#PREFIX = xterm -T dvservice4 -e gdb --args
80#PREFIX = valgrind --log-file=dv4-%p --leak-check=full --show-reachable=yes 85#PREFIX = valgrind --log-file=dv4-%p --leak-check=full --show-reachable=yes
81CONFIG = $DEFAULTCONFIG 86CONFIG = $DEFAULTCONFIG
@@ -84,7 +89,7 @@ HOSTNAME = localhost
84PORT = 42370 89PORT = 42370
85 90
86[arm] 91[arm]
87DEFAULTSERVICES = core dv statistics 92DEFAULTSERVICES =
88ALLOW_SHUTDOWN = YES 93ALLOW_SHUTDOWN = YES
89ACCEPT_FROM6 = ::1; 94ACCEPT_FROM6 = ::1;
90ACCEPT_FROM = 127.0.0.1; 95ACCEPT_FROM = 127.0.0.1;
@@ -93,6 +98,7 @@ CONFIG = $DEFAULTCONFIG
93HOME = $SERVICEHOME 98HOME = $SERVICEHOME
94HOSTNAME = localhost 99HOSTNAME = localhost
95PORT = 42366 100PORT = 42366
101UNIXPATH = /tmp/gnunet-p4-service-arm.sock
96 102
97[transport-tcp] 103[transport-tcp]
98ALLOW_SHUTDOWN = NO 104ALLOW_SHUTDOWN = NO