diff options
-rw-r--r-- | src/transport/gnunet-communicator-udp.c | 32 | ||||
-rw-r--r-- | src/transport/test_communicator_basic.c | 35 | ||||
-rw-r--r-- | src/transport/transport-testing2.c | 11 | ||||
-rw-r--r-- | src/transport/transport-testing2.h | 1 |
4 files changed, 70 insertions, 9 deletions
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index 72e84567a..344ba5180 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c | |||
@@ -1030,6 +1030,8 @@ check_timeouts (void *cls) | |||
1030 | rt = GNUNET_TIME_absolute_get_remaining (receiver->timeout); | 1030 | rt = GNUNET_TIME_absolute_get_remaining (receiver->timeout); |
1031 | if (0 != rt.rel_value_us) | 1031 | if (0 != rt.rel_value_us) |
1032 | break; | 1032 | break; |
1033 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1034 | "Receiver timed out\n"); | ||
1033 | receiver_destroy (receiver); | 1035 | receiver_destroy (receiver); |
1034 | } | 1036 | } |
1035 | st = GNUNET_TIME_UNIT_FOREVER_REL; | 1037 | st = GNUNET_TIME_UNIT_FOREVER_REL; |
@@ -1257,23 +1259,35 @@ handle_ack (void *cls, const struct GNUNET_PeerIdentity *pid, void *value) | |||
1257 | { | 1259 | { |
1258 | const struct UDPAck *ack = cls; | 1260 | const struct UDPAck *ack = cls; |
1259 | struct ReceiverAddress *receiver = value; | 1261 | struct ReceiverAddress *receiver = value; |
1262 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1263 | "in handle ack\n"); | ||
1260 | 1264 | ||
1261 | (void) pid; | 1265 | (void) pid; |
1262 | for (struct SharedSecret *ss = receiver->ss_head; NULL != ss; ss = ss->next) | 1266 | for (struct SharedSecret *ss = receiver->ss_head; NULL != ss; ss = ss->next) |
1263 | { | 1267 | { |
1268 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1269 | "Checking shared secrets\n"); | ||
1264 | if (0 == memcmp (&ack->cmac, &ss->cmac, sizeof(struct GNUNET_HashCode))) | 1270 | if (0 == memcmp (&ack->cmac, &ss->cmac, sizeof(struct GNUNET_HashCode))) |
1265 | { | 1271 | { |
1266 | uint32_t allowed; | 1272 | uint32_t allowed; |
1273 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1274 | "Found matching mac\n"); | ||
1267 | 1275 | ||
1268 | allowed = ntohl (ack->sequence_max); | 1276 | allowed = ntohl (ack->sequence_max); |
1269 | 1277 | ||
1270 | if (allowed > ss->sequence_allowed) | 1278 | if (allowed > ss->sequence_allowed) |
1271 | { | 1279 | { |
1280 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1281 | "%u > %u (%u)\n", allowed, ss->sequence_allowed, | ||
1282 | receiver->acks_available); | ||
1283 | |||
1272 | receiver->acks_available += (allowed - ss->sequence_allowed); | 1284 | receiver->acks_available += (allowed - ss->sequence_allowed); |
1273 | if ((allowed - ss->sequence_allowed) == receiver->acks_available) | 1285 | if ((allowed - ss->sequence_allowed) == receiver->acks_available) |
1274 | { | 1286 | { |
1275 | /* we just incremented from zero => MTU change! */ | 1287 | /* we just incremented from zero => MTU change! */ |
1276 | setup_receiver_mq (receiver); | 1288 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1289 | "we just incremented from zero => MTU change!\n"); | ||
1290 | //TODO setup_receiver_mq (receiver); | ||
1277 | } | 1291 | } |
1278 | ss->sequence_allowed = allowed; | 1292 | ss->sequence_allowed = allowed; |
1279 | /* move ss to head to avoid discarding it anytime soon! */ | 1293 | /* move ss to head to avoid discarding it anytime soon! */ |
@@ -1361,6 +1375,9 @@ consider_ss_ack (struct SharedSecret *ss) | |||
1361 | ack.header.size = htons (sizeof(ack)); | 1375 | ack.header.size = htons (sizeof(ack)); |
1362 | ack.sequence_max = htonl (ss->sequence_allowed); | 1376 | ack.sequence_max = htonl (ss->sequence_allowed); |
1363 | ack.cmac = ss->cmac; | 1377 | ack.cmac = ss->cmac; |
1378 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1379 | "Notifying transport of UDPAck %s\n", | ||
1380 | GNUNET_i2s_full (&ss->sender->target)); | ||
1364 | GNUNET_TRANSPORT_communicator_notify (ch, | 1381 | GNUNET_TRANSPORT_communicator_notify (ch, |
1365 | &ss->sender->target, | 1382 | &ss->sender->target, |
1366 | COMMUNICATOR_ADDRESS_PREFIX, | 1383 | COMMUNICATOR_ADDRESS_PREFIX, |
@@ -2031,11 +2048,12 @@ static void | |||
2031 | mq_destroy (struct GNUNET_MQ_Handle *mq, void *impl_state) | 2048 | mq_destroy (struct GNUNET_MQ_Handle *mq, void *impl_state) |
2032 | { | 2049 | { |
2033 | struct ReceiverAddress *receiver = impl_state; | 2050 | struct ReceiverAddress *receiver = impl_state; |
2034 | 2051 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |
2052 | "MQ destroyed\n"); | ||
2035 | if (mq == receiver->mq) | 2053 | if (mq == receiver->mq) |
2036 | { | 2054 | { |
2037 | receiver->mq = NULL; | 2055 | receiver->mq = NULL; |
2038 | receiver_destroy (receiver); | 2056 | //receiver_destroy (receiver); |
2039 | } | 2057 | } |
2040 | } | 2058 | } |
2041 | 2059 | ||
@@ -2093,7 +2111,7 @@ setup_receiver_mq (struct ReceiverAddress *receiver) | |||
2093 | GNUNET_TRANSPORT_communicator_mq_del (receiver->qh); | 2111 | GNUNET_TRANSPORT_communicator_mq_del (receiver->qh); |
2094 | receiver->qh = NULL; | 2112 | receiver->qh = NULL; |
2095 | } | 2113 | } |
2096 | GNUNET_assert (NULL == receiver->mq); | 2114 | //GNUNET_assert (NULL == receiver->mq); |
2097 | switch (receiver->address->sa_family) | 2115 | switch (receiver->address->sa_family) |
2098 | { | 2116 | { |
2099 | case AF_INET: | 2117 | case AF_INET: |
@@ -2190,6 +2208,9 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address) | |||
2190 | &receiver->target, | 2208 | &receiver->target, |
2191 | receiver, | 2209 | receiver, |
2192 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 2210 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
2211 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2212 | "Added %s to receivers\n", | ||
2213 | GNUNET_i2s_full (&receiver->target)); | ||
2193 | receiver->timeout = | 2214 | receiver->timeout = |
2194 | GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 2215 | GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
2195 | receiver->hn = GNUNET_CONTAINER_heap_insert (receivers_heap, | 2216 | receiver->hn = GNUNET_CONTAINER_heap_insert (receivers_heap, |
@@ -2336,6 +2357,9 @@ enc_notify_cb (void *cls, | |||
2336 | const struct UDPAck *ack; | 2357 | const struct UDPAck *ack; |
2337 | 2358 | ||
2338 | (void) cls; | 2359 | (void) cls; |
2360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2361 | "Storing UDPAck received from backchannel from %s\n", | ||
2362 | GNUNET_i2s_full (sender)); | ||
2339 | if ((ntohs (msg->type) != GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK) || | 2363 | if ((ntohs (msg->type) != GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK) || |
2340 | (ntohs (msg->size) != sizeof(struct UDPAck))) | 2364 | (ntohs (msg->size) != sizeof(struct UDPAck))) |
2341 | { | 2365 | { |
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c index e99db7cfb..1dfcf2371 100644 --- a/src/transport/test_communicator_basic.c +++ b/src/transport/test_communicator_basic.c | |||
@@ -70,9 +70,9 @@ static struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *my_tc; | |||
70 | 70 | ||
71 | #define LONG_MESSAGE_SIZE 32000 | 71 | #define LONG_MESSAGE_SIZE 32000 |
72 | 72 | ||
73 | #define BURST_PACKETS 5000 | 73 | #define BURST_PACKETS 50 |
74 | 74 | ||
75 | #define TOTAL_ITERATIONS 5 | 75 | #define TOTAL_ITERATIONS 1 |
76 | 76 | ||
77 | #define PEER_A 0 | 77 | #define PEER_A 0 |
78 | 78 | ||
@@ -288,6 +288,34 @@ short_test (void *cls) | |||
288 | timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS); | 288 | timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS); |
289 | } | 289 | } |
290 | 290 | ||
291 | static int test_prepared = GNUNET_NO; | ||
292 | |||
293 | /** | ||
294 | * This helps establishing the backchannel | ||
295 | */ | ||
296 | static void | ||
297 | prepare_test (void *cls) | ||
298 | { | ||
299 | char *payload; | ||
300 | |||
301 | if (GNUNET_YES == test_prepared) | ||
302 | { | ||
303 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | ||
304 | &short_test, | ||
305 | NULL); | ||
306 | return; | ||
307 | } | ||
308 | test_prepared = GNUNET_YES; | ||
309 | payload = make_payload (SHORT_MESSAGE_SIZE); | ||
310 | GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, | ||
311 | &prepare_test, | ||
312 | NULL, | ||
313 | payload, | ||
314 | SHORT_MESSAGE_SIZE); | ||
315 | GNUNET_free (payload); | ||
316 | } | ||
317 | |||
318 | |||
291 | 319 | ||
292 | /** | 320 | /** |
293 | * @brief Handle opening of queue | 321 | * @brief Handle opening of queue |
@@ -318,7 +346,7 @@ add_queue_cb (void *cls, | |||
318 | to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 346 | to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
319 | &latency_timeout, | 347 | &latency_timeout, |
320 | NULL); | 348 | NULL); |
321 | short_test (NULL); | 349 | prepare_test (NULL); |
322 | } | 350 | } |
323 | 351 | ||
324 | 352 | ||
@@ -501,6 +529,7 @@ run (void *cls) | |||
501 | "transport", | 529 | "transport", |
502 | communicator_binary, | 530 | communicator_binary, |
503 | cfg_peers_name[i], | 531 | cfg_peers_name[i], |
532 | &peer_id[i], | ||
504 | &communicator_available_cb, | 533 | &communicator_available_cb, |
505 | &add_address_cb, | 534 | &add_address_cb, |
506 | &queue_create_reply_cb, | 535 | &queue_create_reply_cb, |
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c index fe2f28f54..fc6d13590 100644 --- a/src/transport/transport-testing2.c +++ b/src/transport/transport-testing2.c | |||
@@ -84,6 +84,8 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle | |||
84 | */ | 84 | */ |
85 | char *cfg_filename; | 85 | char *cfg_filename; |
86 | 86 | ||
87 | struct GNUNET_PeerIdentity peer_id; | ||
88 | |||
87 | /** | 89 | /** |
88 | * @brief Handle to the transport service | 90 | * @brief Handle to the transport service |
89 | */ | 91 | */ |
@@ -368,7 +370,8 @@ handle_communicator_backchannel (void *cls, | |||
368 | struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *cbi; | 370 | struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *cbi; |
369 | struct GNUNET_MQ_Envelope *env; | 371 | struct GNUNET_MQ_Envelope *env; |
370 | 372 | ||
371 | 373 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |
374 | "Received backchannel message\n"); | ||
372 | if (tc_h->bc_enabled != GNUNET_YES) | 375 | if (tc_h->bc_enabled != GNUNET_YES) |
373 | { | 376 | { |
374 | GNUNET_SERVICE_client_continue (client->client); | 377 | GNUNET_SERVICE_client_continue (client->client); |
@@ -386,7 +389,7 @@ handle_communicator_backchannel (void *cls, | |||
386 | cbi, | 389 | cbi, |
387 | isize, | 390 | isize, |
388 | GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING); | 391 | GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING); |
389 | cbi->pid = bc_msg->pid; | 392 | cbi->pid = tc_h->peer_id; |
390 | memcpy (&cbi[1], msg, isize); | 393 | memcpy (&cbi[1], msg, isize); |
391 | 394 | ||
392 | 395 | ||
@@ -934,6 +937,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( | |||
934 | const char *service_name, | 937 | const char *service_name, |
935 | const char *binary_name, | 938 | const char *binary_name, |
936 | const char *cfg_filename, | 939 | const char *cfg_filename, |
940 | const struct GNUNET_PeerIdentity *peer_id, | ||
937 | GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback | 941 | GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback |
938 | communicator_available_cb, | 942 | communicator_available_cb, |
939 | GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb, | 943 | GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb, |
@@ -971,6 +975,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( | |||
971 | tc_h->add_queue_cb = add_queue_cb; | 975 | tc_h->add_queue_cb = add_queue_cb; |
972 | tc_h->incoming_msg_cb = incoming_message_cb; | 976 | tc_h->incoming_msg_cb = incoming_message_cb; |
973 | tc_h->bc_cb = bc_cb; | 977 | tc_h->bc_cb = bc_cb; |
978 | tc_h->peer_id = *peer_id; | ||
974 | tc_h->cb_cls = cb_cls; | 979 | tc_h->cb_cls = cb_cls; |
975 | 980 | ||
976 | /* Start communicator part of service */ | 981 | /* Start communicator part of service */ |
@@ -1069,6 +1074,8 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_send | |||
1069 | struct GNUNET_MQ_Envelope *env; | 1074 | struct GNUNET_MQ_Envelope *env; |
1070 | size_t inbox_size; | 1075 | size_t inbox_size; |
1071 | 1076 | ||
1077 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1078 | "Sending message\n"); | ||
1072 | inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size; | 1079 | inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size; |
1073 | env = GNUNET_MQ_msg_extra (msg, | 1080 | env = GNUNET_MQ_msg_extra (msg, |
1074 | inbox_size, | 1081 | inbox_size, |
diff --git a/src/transport/transport-testing2.h b/src/transport/transport-testing2.h index 96a08a193..7a449f081 100644 --- a/src/transport/transport-testing2.h +++ b/src/transport/transport-testing2.h | |||
@@ -171,6 +171,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( | |||
171 | const char *service_name, | 171 | const char *service_name, |
172 | const char *binary_name, | 172 | const char *binary_name, |
173 | const char *cfg_filename, | 173 | const char *cfg_filename, |
174 | const struct GNUNET_PeerIdentity *peer_id, | ||
174 | GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback | 175 | GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback |
175 | communicator_available_cb, | 176 | communicator_available_cb, |
176 | GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb, | 177 | GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb, |