aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * 25 *
26 * TODO: 26 * TODO:
27 * - if we do not receive an ACK in response to our 27 * - remove AddressValidations, incorporate them into the PeerAddressLists
28 * HELLO, retransmit HELLO!
29 */ 28 */
30#include "platform.h" 29#include "platform.h"
31#include "gnunet_client_lib.h" 30#include "gnunet_client_lib.h"
@@ -307,7 +306,12 @@ struct MessageQueue
307 /** 306 /**
308 * Neighbor this entry belongs to. 307 * Neighbor this entry belongs to.
309 */ 308 */
310 struct NeighborList *neighbor; 309 /*struct NeighborList *neighbor;*/
310
311 /**
312 * Peer ID of the Neighbor this entry belongs to.
313 */
314 struct GNUNET_PeerIdentity *neighbor_id;
311 315
312 /** 316 /**
313 * Plugin that we used for the transmission. 317 * Plugin that we used for the transmission.
@@ -1060,16 +1064,14 @@ transmit_send_continuation (void *cls,
1060 struct NeighborList *n; 1064 struct NeighborList *n;
1061 1065
1062 GNUNET_assert (mq != NULL); 1066 GNUNET_assert (mq != NULL);
1063 n = mq->neighbor; 1067 n = find_neighbor(mq->neighbor_id);
1064 GNUNET_assert (n != NULL); 1068 if (n == NULL) /* Neighbor must have been removed asynchronously! */
1069 return;
1070
1071 /* Otherwise, let's make sure we've got the right peer */
1065 GNUNET_assert (0 == 1072 GNUNET_assert (0 ==
1066 memcmp (&n->id, target, 1073 memcmp (&n->id, target,
1067 sizeof (struct GNUNET_PeerIdentity))); 1074 sizeof (struct GNUNET_PeerIdentity)));
1068/* rl = n->plugins;
1069 while ((rl != NULL) && (rl->plugin != mq->plugin))
1070 rl = rl->next;
1071 GNUNET_assert (rl != NULL);
1072*/
1073 1075
1074 if (result == GNUNET_OK) 1076 if (result == GNUNET_OK)
1075 { 1077 {
@@ -1221,7 +1223,7 @@ try_transmission_to_peer (struct NeighborList *neighbor)
1221#endif 1223#endif
1222 1224
1223 return rl->plugin->api->send (rl->plugin->api->cls, 1225 return rl->plugin->api->send (rl->plugin->api->cls,
1224 &neighbor->id, 1226 mq->neighbor_id,
1225 mq->message_buf, 1227 mq->message_buf,
1226 mq->message_buf_size, 1228 mq->message_buf_size,
1227 mq->priority, 1229 mq->priority,
@@ -1280,7 +1282,9 @@ transmit_to_peer (struct TransportClient *client,
1280 memcpy (m, message_buf, message_buf_size); 1282 memcpy (m, message_buf, message_buf_size);
1281 mq->message_buf = m; 1283 mq->message_buf = m;
1282 mq->message_buf_size = message_buf_size; 1284 mq->message_buf_size = message_buf_size;
1283 mq->neighbor = neighbor; 1285 mq->neighbor_id = GNUNET_malloc(sizeof (struct GNUNET_PeerIdentity));
1286
1287 memcpy(mq->neighbor_id, &neighbor->id, sizeof(struct GNUNET_PeerIdentity));
1284 mq->internal_msg = is_internal; 1288 mq->internal_msg = is_internal;
1285 mq->priority = priority; 1289 mq->priority = priority;
1286 1290
@@ -1882,6 +1886,7 @@ add_peer_address(struct NeighborList *neighbor, const char *addr, size_t addrlen
1882 1886
1883 GNUNET_assert(addr != NULL); 1887 GNUNET_assert(addr != NULL);
1884 1888
1889 new_address = NULL;
1885 while (head != NULL) 1890 while (head != NULL)
1886 { 1891 {
1887 new_address = GNUNET_malloc(sizeof(struct PeerAddressList)); 1892 new_address = GNUNET_malloc(sizeof(struct PeerAddressList));
@@ -2303,7 +2308,7 @@ disconnect_neighbor (struct NeighborList *current_handle, int check)
2303 while (NULL != (mq = n->messages)) 2308 while (NULL != (mq = n->messages))
2304 { 2309 {
2305 n->messages = mq->next; 2310 n->messages = mq->next;
2306 GNUNET_assert (mq->neighbor == n); 2311 GNUNET_assert (0 == memcmp(mq->neighbor_id, &n->id, sizeof(struct GNUNET_PeerIdentity)));
2307 GNUNET_free (mq); 2312 GNUNET_free (mq);
2308 } 2313 }
2309 if (n->timeout_task != GNUNET_SCHEDULER_NO_TASK) 2314 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,
259 GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2); 259 GNUNET_TRANSPORT_get_hello (p2.th, &exchange_hello_last, &p2);
260} 260}
261 261
262#if WRITECONFIG
262static void 263static void
263setTransportOptions(char * filename) 264setTransportOptions(char * filename)
264{ 265{
@@ -294,6 +295,7 @@ setTransportOptions(char * filename)
294 GNUNET_CONFIGURATION_destroy(tempcfg); 295 GNUNET_CONFIGURATION_destroy(tempcfg);
295 return; 296 return;
296} 297}
298#endif
297 299
298static void 300static void
299run (void *cls, 301run (void *cls,
@@ -305,14 +307,19 @@ run (void *cls,
305 OKPP; 307 OKPP;
306 sched = s; 308 sched = s;
307 309
308 setTransportOptions("test_transport_api_peer1.conf");
309 setTransportOptions("test_transport_api_peer2.conf");
310
311 die_task = GNUNET_SCHEDULER_add_delayed (sched, 310 die_task = GNUNET_SCHEDULER_add_delayed (sched,
312 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 1), &end_badly, NULL); 311 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 1), &end_badly, NULL);
313 312
314 setup_peer (&p1, "test_transport_api_peer1.conf"); 313 if (is_udp)
315 setup_peer (&p2, "test_transport_api_peer2.conf"); 314 {
315 setup_peer (&p1, "test_transport_api_udp_peer1.conf");
316 setup_peer (&p2, "test_transport_api_udp_peer2.conf");
317 }
318 else if (is_tcp)
319 {
320 setup_peer (&p1, "test_transport_api_tcp_peer1.conf");
321 setup_peer (&p2, "test_transport_api_tcp_peer2.conf");
322 }
316 323
317 GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1); 324 GNUNET_TRANSPORT_get_hello (p1.th, &exchange_hello, &p1);
318} 325}
@@ -330,7 +337,9 @@ check ()
330 NULL 337 NULL
331 }; 338 };
332 339
340#if WRITECONFIG
333 setTransportOptions("test_transport_api_data.conf"); 341 setTransportOptions("test_transport_api_data.conf");
342#endif
334 343
335 struct GNUNET_GETOPT_CommandLineOption options[] = { 344 struct GNUNET_GETOPT_CommandLineOption options[] = {
336 GNUNET_GETOPT_OPTION_END 345 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 @@
1[transport-tcp]
2PORT = 12368
3
4[fs]
5ALLOW_SHUTDOWN = YES
6ACCEPT_FROM6 = ::1;
7ACCEPT_FROM = 127.0.0.1;
8BINARY = gnunet-service-fs
9CONFIG = $DEFAULTCONFIG
10HOME = $SERVICEHOME
11HOSTNAME = localhost
12PORT = 2094
13INDEXDB = $SERVICEHOME/idxinfo.lst
14
15[datastore-sqlite]
16FILENAME = $SERVICEHOME/datastore/sqlite.db
17
18[datastore]
19DATABASE = sqlite
20BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
21QUOTA = 100000000
22ALLOW_SHUTDOWN = YES
23ACCEPT_FROM6 = ::1;
24ACCEPT_FROM = 127.0.0.1;
25BINARY = gnunet-service-datastore
26CONFIG = $DEFAULTCONFIG
27HOME = $SERVICEHOME
28HOSTNAME = localhost
29PORT = 2093
30
31[hostlist]
32HTTP-PROXY =
33SERVERS = http://gnunet.org:8080/
34OPTIONS = -b
35BINARY = gnunet-daemon-hostlist
36CONFIG = $DEFAULTCONFIG
37HOME = $SERVICEHOME
38HOSTNAME = localhost
39HTTPPORT = 8080
40
41[topology]
42BINARY = gnunet-daemon-topology
43CONFIG = $DEFAULTCONFIG
44FRIENDS = $SERVICEHOME/friends
45TARGET-CONNECTION-COUNT = 16
46AUTOCONNECT = YES
47FRIENDS-ONLY = NO
48MINIMUM-FRIENDS = 0
49
50[core]
51TOTAL_QUOTA_OUT = 3932160
52TOTAL_QUOTA_IN = 3932160
53ALLOW_SHUTDOWN = YES
54ACCEPT_FROM6 = ::1;
55ACCEPT_FROM = 127.0.0.1;
56BINARY = gnunet-service-core
57CONFIG = $DEFAULTCONFIG
58HOME = $SERVICEHOME
59HOSTNAME = localhost
60PORT = 2092
61
62[transport]
63PLUGINS = tcp
64DEBUG = NO
65PREFIX =
66ALLOW_SHUTDOWN = YES
67ACCEPT_FROM6 = ::1;
68ACCEPT_FROM = 127.0.0.1;
69NEIGHBOUR_LIMIT = 50
70BINARY = gnunet-service-transport
71CONFIG = $DEFAULTCONFIG
72HOME = $SERVICEHOME
73HOSTNAME = localhost
74PORT = 12365
75
76[peerinfo]
77TRUST = $SERVICEHOME/data/credit/
78HOSTS = $SERVICEHOME/data/hosts/
79ALLOW_SHUTDOWN = YES
80ACCEPT_FROM6 = ::1;
81ACCEPT_FROM = 127.0.0.1;
82BINARY = gnunet-service-peerinfo
83CONFIG = $DEFAULTCONFIG
84HOME = $SERVICEHOME
85HOSTNAME = localhost
86PORT = 12369
87
88[resolver]
89ALLOW_SHUTDOWN = YES
90ACCEPT_FROM6 = ::1;
91ACCEPT_FROM = 127.0.0.1;
92BINARY = gnunet-service-resolver
93CONFIG = $DEFAULTCONFIG
94HOME = $SERVICEHOME
95HOSTNAME = localhost
96PORT = 12364
97
98[statistics]
99ALLOW_SHUTDOWN = YES
100ACCEPT_FROM6 = ::1;
101ACCEPT_FROM = 127.0.0.1;
102BINARY = gnunet-service-statistics
103CONFIG = $DEFAULTCONFIG
104HOME = $SERVICEHOME
105HOSTNAME = localhost
106PORT = 12367
107
108[arm]
109DEFAULTSERVICES =
110ALLOW_SHUTDOWN = YES
111ACCEPT_FROM6 = ::1;
112ACCEPT_FROM = 127.0.0.1;
113BINARY = gnunet-service-arm
114CONFIG = $DEFAULTCONFIG
115HOME = $SERVICEHOME
116HOSTNAME = localhost
117PORT = 12366
118
119[transport-tcp]
120ALLOW_SHUTDOWN = NO
121TIMEOUT = 300000
122PORT = 12368
123
124[TESTING]
125WEAKRANDOM = YES
126
127[gnunetd]
128HOSTKEY = $SERVICEHOME/.hostkey
129
130[PATHS]
131DEFAULTCONFIG = test_transport_api_tcp_peer1.conf
132SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/
133
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 @@
1[transport-tcp]
2PORT = 22368
3
4[fs]
5ALLOW_SHUTDOWN = YES
6ACCEPT_FROM6 = ::1;
7ACCEPT_FROM = 127.0.0.1;
8BINARY = gnunet-service-fs
9CONFIG = $DEFAULTCONFIG
10HOME = $SERVICEHOME
11HOSTNAME = localhost
12PORT = 2094
13INDEXDB = $SERVICEHOME/idxinfo.lst
14
15[datastore-sqlite]
16FILENAME = $SERVICEHOME/datastore/sqlite.db
17
18[datastore]
19DATABASE = sqlite
20BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
21QUOTA = 100000000
22ALLOW_SHUTDOWN = YES
23ACCEPT_FROM6 = ::1;
24ACCEPT_FROM = 127.0.0.1;
25BINARY = gnunet-service-datastore
26CONFIG = $DEFAULTCONFIG
27HOME = $SERVICEHOME
28HOSTNAME = localhost
29PORT = 2093
30
31[hostlist]
32HTTP-PROXY =
33SERVERS = http://gnunet.org:8080/
34OPTIONS = -b
35BINARY = gnunet-daemon-hostlist
36CONFIG = $DEFAULTCONFIG
37HOME = $SERVICEHOME
38HOSTNAME = localhost
39HTTPPORT = 8080
40
41[topology]
42BINARY = gnunet-daemon-topology
43CONFIG = $DEFAULTCONFIG
44FRIENDS = $SERVICEHOME/friends
45TARGET-CONNECTION-COUNT = 16
46AUTOCONNECT = YES
47FRIENDS-ONLY = NO
48MINIMUM-FRIENDS = 0
49
50[core]
51TOTAL_QUOTA_OUT = 3932160
52TOTAL_QUOTA_IN = 3932160
53ALLOW_SHUTDOWN = YES
54ACCEPT_FROM6 = ::1;
55ACCEPT_FROM = 127.0.0.1;
56BINARY = gnunet-service-core
57CONFIG = $DEFAULTCONFIG
58HOME = $SERVICEHOME
59HOSTNAME = localhost
60PORT = 2092
61
62[transport]
63PLUGINS = tcp
64DEBUG = NO
65PREFIX =
66ALLOW_SHUTDOWN = YES
67ACCEPT_FROM6 = ::1;
68ACCEPT_FROM = 127.0.0.1;
69NEIGHBOUR_LIMIT = 50
70BINARY = gnunet-service-transport
71CONFIG = $DEFAULTCONFIG
72HOME = $SERVICEHOME
73HOSTNAME = localhost
74PORT = 22365
75
76[peerinfo]
77TRUST = $SERVICEHOME/data/credit/
78HOSTS = $SERVICEHOME/data/hosts/
79ALLOW_SHUTDOWN = YES
80ACCEPT_FROM6 = ::1;
81ACCEPT_FROM = 127.0.0.1;
82BINARY = gnunet-service-peerinfo
83CONFIG = $DEFAULTCONFIG
84HOME = $SERVICEHOME
85HOSTNAME = localhost
86PORT = 22369
87
88[resolver]
89ALLOW_SHUTDOWN = YES
90ACCEPT_FROM6 = ::1;
91ACCEPT_FROM = 127.0.0.1;
92BINARY = gnunet-service-resolver
93CONFIG = $DEFAULTCONFIG
94HOME = $SERVICEHOME
95HOSTNAME = localhost
96PORT = 22364
97
98[statistics]
99ALLOW_SHUTDOWN = YES
100ACCEPT_FROM6 = ::1;
101ACCEPT_FROM = 127.0.0.1;
102BINARY = gnunet-service-statistics
103CONFIG = $DEFAULTCONFIG
104HOME = $SERVICEHOME
105HOSTNAME = localhost
106PORT = 22367
107
108[arm]
109DEFAULTSERVICES =
110ALLOW_SHUTDOWN = YES
111ACCEPT_FROM6 = ::1;
112ACCEPT_FROM = 127.0.0.1;
113BINARY = gnunet-service-arm
114CONFIG = $DEFAULTCONFIG
115HOME = $SERVICEHOME
116HOSTNAME = localhost
117PORT = 22366
118
119[transport-tcp]
120ALLOW_SHUTDOWN = NO
121TIMEOUT = 300000
122PORT = 22368
123
124[TESTING]
125WEAKRANDOM = YES
126
127[gnunetd]
128HOSTKEY = $SERVICEHOME/.hostkey
129
130[PATHS]
131DEFAULTCONFIG = test_transport_api_tcp_peer2.conf
132SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/
133
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
60PORT = 2092 60PORT = 2092
61 61
62[transport] 62[transport]
63PREFIX =
64DEBUG = NO
65PLUGINS = udp 63PLUGINS = udp
64DEBUG = NO
65PREFIX =
66ALLOW_SHUTDOWN = YES 66ALLOW_SHUTDOWN = YES
67ACCEPT_FROM6 = ::1; 67ACCEPT_FROM6 = ::1;
68ACCEPT_FROM = 127.0.0.1; 68ACCEPT_FROM = 127.0.0.1;
@@ -128,6 +128,6 @@ WEAKRANDOM = YES
128HOSTKEY = $SERVICEHOME/.hostkey 128HOSTKEY = $SERVICEHOME/.hostkey
129 129
130[PATHS] 130[PATHS]
131DEFAULTCONFIG = test_transport_api_peer1.conf 131DEFAULTCONFIG = test_transport_api_udp_peer1.conf
132SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/ 132SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/
133 133
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
60PORT = 2092 60PORT = 2092
61 61
62[transport] 62[transport]
63PREFIX =
64DEBUG = NO
65PLUGINS = udp 63PLUGINS = udp
64DEBUG = NO
65PREFIX =
66ALLOW_SHUTDOWN = YES 66ALLOW_SHUTDOWN = YES
67ACCEPT_FROM6 = ::1; 67ACCEPT_FROM6 = ::1;
68ACCEPT_FROM = 127.0.0.1; 68ACCEPT_FROM = 127.0.0.1;
@@ -128,6 +128,6 @@ WEAKRANDOM = YES
128HOSTKEY = $SERVICEHOME/.hostkey 128HOSTKEY = $SERVICEHOME/.hostkey
129 129
130[PATHS] 130[PATHS]
131DEFAULTCONFIG = test_transport_api_peer2.conf 131DEFAULTCONFIG = test_transport_api_udp_peer2.conf
132SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/ 132SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/
133 133