aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/gnunet-communicator-udp.c247
-rw-r--r--src/transport/test_communicator_basic.c189
-rw-r--r--src/transport/transport-testing2.c10
3 files changed, 212 insertions, 234 deletions
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c
index 579f744e5..1df79745a 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -93,7 +93,7 @@
93 */ 93 */
94#define GCM_TAG_SIZE (128 / 8) 94#define GCM_TAG_SIZE (128 / 8)
95 95
96#define GENERATE_AT_ONCE 20 96#define GENERATE_AT_ONCE 2
97 97
98/** 98/**
99 * If we fall below this number of available KCNs, 99 * If we fall below this number of available KCNs,
@@ -256,6 +256,12 @@ struct UDPAck
256 uint32_t sequence_max GNUNET_PACKED; 256 uint32_t sequence_max GNUNET_PACKED;
257 257
258 /** 258 /**
259 * Sequence acknowledgement limit. Specifies current maximum sequence
260 * number supported by receiver.
261 */
262 uint32_t acks_available GNUNET_PACKED;
263
264 /**
259 * CMAC of the base key being acknowledged. 265 * CMAC of the base key being acknowledged.
260 */ 266 */
261 struct GNUNET_HashCode cmac; 267 struct GNUNET_HashCode cmac;
@@ -664,6 +670,10 @@ struct BroadcastInterface
664 int found; 670 int found;
665}; 671};
666 672
673/**
674 * Shared secret we finished the last kce working queue for.
675 */
676struct SharedSecret *ss_finished;
667 677
668/** 678/**
669 * Cache of pre-generated key IDs. 679 * Cache of pre-generated key IDs.
@@ -681,6 +691,16 @@ static struct GNUNET_SCHEDULER_Task *read_task;
681static struct GNUNET_SCHEDULER_Task *timeout_task; 691static struct GNUNET_SCHEDULER_Task *timeout_task;
682 692
683/** 693/**
694 * ID of kce working queue task
695 */
696static struct GNUNET_SCHEDULER_Task *kce_task;
697
698/**
699 * Is the kce_task finished?
700 */
701static int kce_task_finished = GNUNET_NO;
702
703/**
684 * ID of master broadcast task 704 * ID of master broadcast task
685 */ 705 */
686static struct GNUNET_SCHEDULER_Task *broadcast_task; 706static struct GNUNET_SCHEDULER_Task *broadcast_task;
@@ -807,15 +827,26 @@ bi_destroy (struct BroadcastInterface *bi)
807static void 827static void
808receiver_destroy (struct ReceiverAddress *receiver) 828receiver_destroy (struct ReceiverAddress *receiver)
809{ 829{
830 struct GNUNET_MQ_Handle *mq;
810 831
811 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 832 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
812 "Disconnecting receiver for peer `%s'\n", 833 "Disconnecting receiver for peer `%s'\n",
813 GNUNET_i2s (&receiver->target)); 834 GNUNET_i2s (&receiver->target));
835 if (NULL != (mq = receiver->kx_mq))
836 {
837 receiver->kx_mq = NULL;
838 GNUNET_MQ_destroy (mq);
839 }
814 if (NULL != receiver->kx_qh) 840 if (NULL != receiver->kx_qh)
815 { 841 {
816 GNUNET_TRANSPORT_communicator_mq_del (receiver->kx_qh); 842 GNUNET_TRANSPORT_communicator_mq_del (receiver->kx_qh);
817 receiver->kx_qh = NULL; 843 receiver->kx_qh = NULL;
818 } 844 }
845 if (NULL != (mq = receiver->d_mq))
846 {
847 receiver->d_mq = NULL;
848 GNUNET_MQ_destroy (mq);
849 }
819 if (NULL != receiver->d_qh) 850 if (NULL != receiver->d_qh)
820 { 851 {
821 GNUNET_TRANSPORT_communicator_mq_del (receiver->d_qh); 852 GNUNET_TRANSPORT_communicator_mq_del (receiver->d_qh);
@@ -932,19 +963,13 @@ secret_destroy (struct SharedSecret *ss)
932 { 963 {
933 GNUNET_CONTAINER_DLL_remove (sender->ss_head, sender->ss_tail, ss); 964 GNUNET_CONTAINER_DLL_remove (sender->ss_head, sender->ss_tail, ss);
934 sender->num_secrets--; 965 sender->num_secrets--;
935 sender->acks_available -= ss->active_kce_count;
936 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
937 "%u acks available after secrect destroy.\n",
938 sender->acks_available);
939 } 966 }
940 if (NULL != (receiver = ss->receiver)) 967 if (NULL != (receiver = ss->receiver))
941 { 968 {
942 GNUNET_CONTAINER_DLL_remove (receiver->ss_head, receiver->ss_tail, ss); 969 GNUNET_CONTAINER_DLL_remove (receiver->ss_head, receiver->ss_tail, ss);
943 receiver->num_secrets--; 970 receiver->num_secrets--;
944 receiver->acks_available -= (ss->sequence_allowed - ss->sequence_used); 971 // Uncomment this for alternativ 1 of backchannel functionality
945 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 972 // receiver->acks_available -= (ss->sequence_allowed - ss->sequence_used);
946 "%u acks available after secrect destroy.\n",
947 receiver->acks_available);
948 } 973 }
949 while (NULL != (kce = ss->kce_head)) 974 while (NULL != (kce = ss->kce_head))
950 kce_destroy (kce); 975 kce_destroy (kce);
@@ -1259,10 +1284,6 @@ setup_shared_secret_enc (const struct GNUNET_CRYPTO_EcdhePrivateKey *ephemeral,
1259 &receiver->target.public_key, 1284 &receiver->target.public_key,
1260 &ss->master); 1285 &ss->master);
1261 calculate_cmac (ss); 1286 calculate_cmac (ss);
1262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1263 "Created cmac %s for secret %p.\n",
1264 GNUNET_h2s (&ss->cmac),
1265 ss);
1266 ss->receiver = receiver; 1287 ss->receiver = receiver;
1267 GNUNET_CONTAINER_DLL_insert (receiver->ss_head, receiver->ss_tail, ss); 1288 GNUNET_CONTAINER_DLL_insert (receiver->ss_head, receiver->ss_tail, ss);
1268 receiver->num_secrets++; 1289 receiver->num_secrets++;
@@ -1311,27 +1332,41 @@ handle_ack (void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
1311 1332
1312 allowed = ntohl (ack->sequence_max); 1333 allowed = ntohl (ack->sequence_max);
1313 1334
1314 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1315 "%u > %u (%u)\n", allowed, ss->sequence_allowed,
1316 receiver->acks_available);
1317 if (allowed > ss->sequence_allowed) 1335 if (allowed > ss->sequence_allowed)
1318 { 1336 {
1319 receiver->acks_available += (allowed - ss->sequence_allowed); 1337 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1338 "%u > %u (%u %u) for secrect %s\n", allowed,
1339 ss->sequence_allowed,
1340 receiver->acks_available,
1341 ack->acks_available,
1342 GNUNET_h2s (&ss->master));
1343 // Uncomment this for alternativ 1 of backchannel functionality
1344 /*receiver->acks_available += (allowed - ss->sequence_allowed);
1320 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1345 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1321 "Tell transport we have more acks!\n"); 1346 "Tell transport we have more acks!\n");
1322 GNUNET_TRANSPORT_communicator_mq_update (ch, 1347 GNUNET_TRANSPORT_communicator_mq_update (ch,
1323 receiver->d_qh, 1348 receiver->d_qh,
1324 (allowed 1349 (allowed
1325 - ss->sequence_allowed), 1350 - ss->sequence_allowed),
1326 1); 1351 1);*/
1327 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1328 "%u acks made available.\n",
1329 receiver->acks_available);
1330 ss->sequence_allowed = allowed; 1352 ss->sequence_allowed = allowed;
1331 /* move ss to head to avoid discarding it anytime soon! */ 1353 /* move ss to head to avoid discarding it anytime soon! */
1332 GNUNET_CONTAINER_DLL_remove (receiver->ss_head, receiver->ss_tail, ss); 1354 GNUNET_CONTAINER_DLL_remove (receiver->ss_head, receiver->ss_tail, ss);
1333 GNUNET_CONTAINER_DLL_insert (receiver->ss_head, receiver->ss_tail, ss); 1355 GNUNET_CONTAINER_DLL_insert (receiver->ss_head, receiver->ss_tail, ss);
1334 } 1356 }
1357
1358 // Uncomment this for alternativ 2 of backchannel functionality
1359 if (receiver->acks_available != ack->acks_available)
1360 {
1361 receiver->acks_available = ack->acks_available;
1362 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1363 "Tell transport we have different number of acks!\n");
1364 GNUNET_TRANSPORT_communicator_mq_update (ch,
1365 receiver->d_qh,
1366 receiver->acks_available,
1367 1);
1368 }
1369 // Until here for alternativ 2
1335 return GNUNET_NO; 1370 return GNUNET_NO;
1336 } 1371 }
1337 } 1372 }
@@ -1390,12 +1425,29 @@ kce_generate_cb (void *cls)
1390{ 1425{
1391 struct SharedSecret *ss = cls; 1426 struct SharedSecret *ss = cls;
1392 1427
1393 for (int i = 0; i < GENERATE_AT_ONCE; i++)
1394 kce_generate (ss, ++ss->sequence_allowed);
1395 1428
1396 /*GNUNET_SCHEDULER_add_delayed (WORKING_QUEUE_INTERVALL, 1429
1397 kce_generate_cb, 1430 if (ss->sender->acks_available < KCN_TARGET)
1398 ss);*/ 1431 {
1432
1433 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1434 "Precomputing keys\n");
1435
1436 for (int i = 0; i < GENERATE_AT_ONCE; i++)
1437 kce_generate (ss, ++ss->sequence_allowed);
1438
1439 kce_task = GNUNET_SCHEDULER_add_delayed (WORKING_QUEUE_INTERVALL,
1440 kce_generate_cb,
1441 ss);
1442 }
1443 else
1444 {
1445 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1446 "We have enough keys.\n");
1447 ss_finished = ss;
1448 kce_task_finished = GNUNET_YES;
1449 }
1450
1399 1451
1400} 1452}
1401 1453
@@ -1406,26 +1458,69 @@ kce_generate_cb (void *cls)
1406 * recently). 1458 * recently).
1407 * 1459 *
1408 * @param ss shared secret to generate ACKs for 1460 * @param ss shared secret to generate ACKs for
1461 * @param intial The SharedSecret came with initial KX.
1409 */ 1462 */
1410static void 1463static void
1411consider_ss_ack (struct SharedSecret *ss) 1464consider_ss_ack (struct SharedSecret *ss, int initial)
1412{ 1465{
1413 GNUNET_assert (NULL != ss->sender); 1466 GNUNET_assert (NULL != ss->sender);
1414 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1467 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1415 "Considering SS UDPAck %s\n", 1468 "Considering SS UDPAck %s\n",
1416 GNUNET_i2s_full (&ss->sender->target)); 1469 GNUNET_i2s_full (&ss->sender->target));
1417 1470
1471 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1472 "We have %u acks available.\n",
1473 ss->sender->acks_available);
1418 /* drop ancient KeyCacheEntries */ 1474 /* drop ancient KeyCacheEntries */
1419 while ((NULL != ss->kce_head) && 1475 while ((NULL != ss->kce_head) &&
1420 (MAX_SQN_DELTA < 1476 (MAX_SQN_DELTA <
1421 ss->kce_head->sequence_number - ss->kce_tail->sequence_number)) 1477 ss->kce_head->sequence_number - ss->kce_tail->sequence_number))
1422 kce_destroy (ss->kce_tail); 1478 kce_destroy (ss->kce_tail);
1423 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1479
1424 "%u active count and %u acks available\n", 1480
1425 ss->active_kce_count, 1481 if (GNUNET_NO == initial)
1426 ss->sender->acks_available); 1482 kce_generate (ss, ++ss->sequence_allowed);
1427 if ((ss->active_kce_count < KCN_THRESHOLD) && (ss->sender->acks_available < 1483
1428 KCN_TARGET) ) 1484 /*if (0 == ss->sender->acks_available)
1485 {
1486 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1487 "Generating keys\n");
1488 while (ss->active_kce_count < KCN_TARGET)
1489 kce_generate (ss, ++ss->sequence_allowed);
1490 }*/
1491
1492 if (((NULL != kce_task) && kce_task_finished) || (GNUNET_NO == initial))
1493 {
1494 struct UDPAck ack;
1495
1496 ack.header.type = htons (GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK);
1497 ack.header.size = htons (sizeof(ack));
1498 ack.sequence_max = htonl (ss_finished->sequence_allowed);
1499 ack.acks_available = ss->sender->acks_available;
1500 ack.cmac = ss_finished->cmac;
1501 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1502 "Notifying transport of UDPAck %s with intial %u\n",
1503 GNUNET_i2s_full (&ss_finished->sender->target),
1504 initial);
1505 GNUNET_TRANSPORT_communicator_notify (ch,
1506 &ss_finished->sender->target,
1507 COMMUNICATOR_ADDRESS_PREFIX,
1508 &ack.header);
1509 kce_task = NULL;
1510 }
1511 else if ((NULL == kce_task) && (KCN_THRESHOLD > ss->sender->acks_available))
1512 {
1513
1514 // kce_generate (ss, ++ss->sequence_allowed);
1515 // kce_generate (ss, ++ss->sequence_allowed);
1516 kce_task = GNUNET_SCHEDULER_add_delayed (WORKING_QUEUE_INTERVALL,
1517 kce_generate_cb,
1518 ss);
1519
1520 }
1521
1522
1523 /*if (ss->active_kce_count < KCN_THRESHOLD)
1429 { 1524 {
1430 struct UDPAck ack; 1525 struct UDPAck ack;
1431 1526
@@ -1435,20 +1530,18 @@ consider_ss_ack (struct SharedSecret *ss)
1435 * For the initial KX (active_kce_count==0), 1530 * For the initial KX (active_kce_count==0),
1436 * we only generate a single KCE to prevent 1531 * we only generate a single KCE to prevent
1437 * unnecessary overhead. 1532 * unnecessary overhead.
1438 */ 1533
1439 GNUNET_SCHEDULER_add_now (kce_generate_cb, ss); 1534 if (0 < ss->active_kce_count)
1440 /*if (0 < ss->sequence_allowed)
1441 { 1535 {
1442 while (ss->active_kce_count < KCN_TARGET) 1536 while (ss->active_kce_count < KCN_TARGET)
1443 kce_generate (ss, ++ss->sequence_allowed); 1537 kce_generate (ss, ++ss->sequence_allowed);
1444 } 1538 }
1445 else {*/ 1539 else {
1446 /*kce_generate (ss, ++ss->sequence_allowed); 1540 kce_generate (ss, ++ss->sequence_allowed);
1447 kce_generate (ss, ++ss->sequence_allowed);*/ 1541 }
1448 // }
1449 ack.header.type = htons (GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK); 1542 ack.header.type = htons (GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK);
1450 ack.header.size = htons (sizeof(ack)); 1543 ack.header.size = htons (sizeof(ack));
1451 ack.sequence_max = htonl (ss->sequence_allowed + GENERATE_AT_ONCE); 1544 ack.sequence_max = htonl (ss->sequence_allowed);
1452 ack.cmac = ss->cmac; 1545 ack.cmac = ss->cmac;
1453 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1546 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1454 "Notifying transport of UDPAck %s\n", 1547 "Notifying transport of UDPAck %s\n",
@@ -1457,7 +1550,7 @@ consider_ss_ack (struct SharedSecret *ss)
1457 &ss->sender->target, 1550 &ss->sender->target,
1458 COMMUNICATOR_ADDRESS_PREFIX, 1551 COMMUNICATOR_ADDRESS_PREFIX,
1459 &ack.header); 1552 &ack.header);
1460 } 1553 }*/
1461} 1554}
1462 1555
1463 1556
@@ -1489,10 +1582,6 @@ decrypt_box (const struct UDPBox *box,
1489 1, 1582 1,
1490 GNUNET_NO); 1583 GNUNET_NO);
1491 kce_destroy (kce); 1584 kce_destroy (kce);
1492 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1493 "decrypting of UDPBox with kid %s and cmac %s failed\n",
1494 GNUNET_sh2s (&box->kid),
1495 GNUNET_h2s (&ss->cmac));
1496 return; 1585 return;
1497 } 1586 }
1498 kce_destroy (kce); 1587 kce_destroy (kce);
@@ -1504,7 +1593,7 @@ decrypt_box (const struct UDPBox *box,
1504 "decrypted UDPBox with kid %s\n", 1593 "decrypted UDPBox with kid %s\n",
1505 GNUNET_sh2s (&box->kid)); 1594 GNUNET_sh2s (&box->kid));
1506 try_handle_plaintext (ss->sender, out_buf, sizeof(out_buf)); 1595 try_handle_plaintext (ss->sender, out_buf, sizeof(out_buf));
1507 consider_ss_ack (ss); 1596 consider_ss_ack (ss, GNUNET_NO);
1508} 1597}
1509 1598
1510 1599
@@ -1561,7 +1650,7 @@ find_sender_by_address (void *cls,
1561 * might already have one, so a fresh one is only allocated 1650 * might already have one, so a fresh one is only allocated
1562 * if one does not yet exist for @a address. 1651 * if one does not yet exist for @a address.
1563 * 1652 *
1564 * @param target peer to generate address for (can be NULL, if we already have one). 1653 * @param target peer to generate address for
1565 * @param address target address 1654 * @param address target address
1566 * @param address_len number of bytes in @a address 1655 * @param address_len number of bytes in @a address
1567 * @return data structure to keep track of key material for 1656 * @return data structure to keep track of key material for
@@ -1581,7 +1670,7 @@ setup_sender (const struct GNUNET_PeerIdentity *target,
1581 target, 1670 target,
1582 &find_sender_by_address, 1671 &find_sender_by_address,
1583 &sc); 1672 &sc);
1584 if ((NULL != sc.sender)||(NULL == target)) 1673 if (NULL != sc.sender)
1585 { 1674 {
1586 reschedule_sender_timeout (sc.sender); 1675 reschedule_sender_timeout (sc.sender);
1587 return sc.sender; 1676 return sc.sender;
@@ -1704,8 +1793,7 @@ sock_read (void *cls)
1704 return; 1793 return;
1705 } 1794 }
1706 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1795 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1707 "Read %lu bytes.\n", 1796 "Read %lu bytes\n", rcvd);
1708 rcvd);
1709 /* first, see if it is a UDPBox */ 1797 /* first, see if it is a UDPBox */
1710 if (rcvd > sizeof(struct UDPBox)) 1798 if (rcvd > sizeof(struct UDPBox))
1711 { 1799 {
@@ -1719,9 +1807,6 @@ sock_read (void *cls)
1719 decrypt_box (box, (size_t) rcvd, kce); 1807 decrypt_box (box, (size_t) rcvd, kce);
1720 return; 1808 return;
1721 } 1809 }
1722 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1723 "No kid %s.\n",
1724 GNUNET_sh2s (&box->kid));
1725 } 1810 }
1726 1811
1727 /* next, check if it is a broadcast */ 1812 /* next, check if it is a broadcast */
@@ -1779,8 +1864,7 @@ sock_read (void *cls)
1779 kx = (const struct InitialKX *) buf; 1864 kx = (const struct InitialKX *) buf;
1780 ss = setup_shared_secret_dec (&kx->ephemeral); 1865 ss = setup_shared_secret_dec (&kx->ephemeral);
1781 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1866 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1782 "Before DEC with ephemeral %s\n", 1867 "Before DEC\n");
1783 GNUNET_e2s (&kx->ephemeral));
1784 1868
1785 if (GNUNET_OK != try_decrypt (ss, 1869 if (GNUNET_OK != try_decrypt (ss,
1786 kx->gcm_tag, 1870 kx->gcm_tag,
@@ -1817,10 +1901,6 @@ sock_read (void *cls)
1817 "Before SETUP_SENDER\n"); 1901 "Before SETUP_SENDER\n");
1818 1902
1819 calculate_cmac (ss); 1903 calculate_cmac (ss);
1820 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1821 "Got cmac %s for secret %p.\n",
1822 GNUNET_h2s (&ss->cmac),
1823 ss);
1824 sender = setup_sender (&uc->sender, (const struct sockaddr *) &sa, salen); 1904 sender = setup_sender (&uc->sender, (const struct sockaddr *) &sa, salen);
1825 ss->sender = sender; 1905 ss->sender = sender;
1826 GNUNET_CONTAINER_DLL_insert (sender->ss_head, sender->ss_tail, ss); 1906 GNUNET_CONTAINER_DLL_insert (sender->ss_head, sender->ss_tail, ss);
@@ -1831,12 +1911,9 @@ sock_read (void *cls)
1831 1, 1911 1,
1832 GNUNET_NO); 1912 GNUNET_NO);
1833 try_handle_plaintext (sender, &uc[1], sizeof(pbuf) - sizeof(*uc)); 1913 try_handle_plaintext (sender, &uc[1], sizeof(pbuf) - sizeof(*uc));
1834 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1914 consider_ss_ack (ss, GNUNET_YES);
1835 "We have %u secrets\n",
1836 sender->num_secrets);
1837 /*if (sender->num_secrets > MAX_SECRETS) 1915 /*if (sender->num_secrets > MAX_SECRETS)
1838 secret_destroy (sender->ss_tail);*/ 1916 secret_destroy (sender->ss_tail);*/
1839 consider_ss_ack (ss);
1840 } 1917 }
1841} 1918}
1842 1919
@@ -2038,8 +2115,6 @@ mq_send_kx (struct GNUNET_MQ_Handle *mq,
2038 GNUNET_CRYPTO_ecdhe_key_create (&epriv); 2115 GNUNET_CRYPTO_ecdhe_key_create (&epriv);
2039 2116
2040 ss = setup_shared_secret_enc (&epriv, receiver); 2117 ss = setup_shared_secret_enc (&epriv, receiver);
2041 /*if (receiver->num_secrets > MAX_SECRETS)
2042 secret_destroy (receiver->ss_tail);*/
2043 setup_cipher (&ss->master, 0, &out_cipher); 2118 setup_cipher (&ss->master, 0, &out_cipher);
2044 /* compute 'uc' */ 2119 /* compute 'uc' */
2045 uc.sender = my_identity; 2120 uc.sender = my_identity;
@@ -2081,10 +2156,8 @@ mq_send_kx (struct GNUNET_MQ_Handle *mq,
2081 receiver->address_len)) 2156 receiver->address_len))
2082 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); 2157 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send");
2083 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2158 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2084 "Sending KX to %s with ephemeral %s\n", 2159 "Sending KX to %s\n", GNUNET_a2s (receiver->address,
2085 GNUNET_a2s (receiver->address, 2160 receiver->address_len));
2086 receiver->address_len),
2087 GNUNET_e2s (&kx.ephemeral));
2088 GNUNET_MQ_impl_send_continue (mq); 2161 GNUNET_MQ_impl_send_continue (mq);
2089} 2162}
2090 2163
@@ -2105,11 +2178,6 @@ mq_send_d (struct GNUNET_MQ_Handle *mq,
2105 struct ReceiverAddress *receiver = impl_state; 2178 struct ReceiverAddress *receiver = impl_state;
2106 uint16_t msize = ntohs (msg->size); 2179 uint16_t msize = ntohs (msg->size);
2107 2180
2108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2109 "sending to receiver %s with %u acks available.\n",
2110 receiver->foreign_addr,
2111 receiver->acks_available);
2112
2113 GNUNET_assert (mq == receiver->d_mq); 2181 GNUNET_assert (mq == receiver->d_mq);
2114 if ((msize > receiver->d_mtu) || 2182 if ((msize > receiver->d_mtu) ||
2115 (0 == receiver->acks_available)) 2183 (0 == receiver->acks_available))
@@ -2123,7 +2191,16 @@ mq_send_d (struct GNUNET_MQ_Handle *mq,
2123 /* begin "BOX" encryption method, scan for ACKs from tail! */ 2191 /* begin "BOX" encryption method, scan for ACKs from tail! */
2124 for (struct SharedSecret *ss = receiver->ss_tail; NULL != ss; ss = ss->prev) 2192 for (struct SharedSecret *ss = receiver->ss_tail; NULL != ss; ss = ss->prev)
2125 { 2193 {
2126 if (ss->sequence_used >= ss->sequence_allowed) 2194 if (0 < ss->sequence_used)
2195 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2196 "Trying to send UDPBox with shared secrect %s sequence_used %u and ss->sequence_allowed %u\n",
2197 GNUNET_h2s (&ss->master),
2198 ss->sequence_used,
2199 ss->sequence_allowed);
2200 // Uncomment this for alternativ 1 of backchannel functionality
2201 // if (ss->sequence_used >= ss->sequence_allowed)
2202 // Uncomment this for alternativ 2 of backchannel functionality
2203 if (0 == ss->sequence_allowed)
2127 { 2204 {
2128 continue; 2205 continue;
2129 } 2206 }
@@ -2134,10 +2211,6 @@ mq_send_d (struct GNUNET_MQ_Handle *mq,
2134 2211
2135 box = (struct UDPBox *) dgram; 2212 box = (struct UDPBox *) dgram;
2136 ss->sequence_used++; 2213 ss->sequence_used++;
2137 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2138 "get kid with sequence number %u and cmac %s.\n",
2139 ss->sequence_used,
2140 GNUNET_h2s (&ss->cmac));
2141 get_kid (&ss->master, ss->sequence_used, &box->kid); 2214 get_kid (&ss->master, ss->sequence_used, &box->kid);
2142 setup_cipher (&ss->master, ss->sequence_used, &out_cipher); 2215 setup_cipher (&ss->master, ss->sequence_used, &out_cipher);
2143 /* Append encrypted payload to dgram */ 2216 /* Append encrypted payload to dgram */
@@ -2157,18 +2230,10 @@ mq_send_d (struct GNUNET_MQ_Handle *mq,
2157 receiver->address_len)) 2230 receiver->address_len))
2158 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send"); 2231 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send");
2159 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2160 "Sending UDPBox to %s with shared secrect %p and kid %s\n", 2233 "Sending UDPBox to %s\n", GNUNET_a2s (receiver->address,
2161 GNUNET_a2s ( 2234 receiver->address_len));
2162 receiver->address,
2163 receiver
2164 ->address_len),
2165 ss,
2166 GNUNET_sh2s (&box->kid));
2167 GNUNET_MQ_impl_send_continue (mq); 2235 GNUNET_MQ_impl_send_continue (mq);
2168 receiver->acks_available--; 2236 // receiver->acks_available--;
2169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2170 "%u acks available after sending.\n",
2171 receiver->acks_available);
2172 if (0 == receiver->acks_available) 2237 if (0 == receiver->acks_available)
2173 { 2238 {
2174 /* We have no more ACKs */ 2239 /* We have no more ACKs */
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c
index 2d550dc16..43c98a401 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -68,6 +68,8 @@ static struct GNUNET_TIME_Absolute timeout;
68 68
69static struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *my_tc; 69static struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *my_tc;
70 70
71#define DROP_RATIO 0.91
72
71#define SHORT_MESSAGE_SIZE 128 73#define SHORT_MESSAGE_SIZE 128
72 74
73#define LONG_MESSAGE_SIZE 32000 /* FIXME */ 75#define LONG_MESSAGE_SIZE 32000 /* FIXME */
@@ -82,9 +84,6 @@ static struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *my_tc;
82 84
83static unsigned int iterations_left = TOTAL_ITERATIONS; 85static unsigned int iterations_left = TOTAL_ITERATIONS;
84 86
85#define DELAY \
86 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,1000)
87
88#define SHORT_BURST_WINDOW \ 87#define SHORT_BURST_WINDOW \
89 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2) 88 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2)
90 89
@@ -100,21 +99,13 @@ enum TestPhase
100}; 99};
101 100
102 101
103static size_t num_sent_short = 0; 102static size_t num_sent = 0;
104
105static size_t num_sent_long = 0;
106
107static size_t num_sent_size = 0;
108 103
109static uint32_t ack = 0; 104static uint32_t ack = 0;
110 105
111static enum TestPhase phase; 106static enum TestPhase phase;
112 107
113static size_t num_received_short = 0; 108static size_t num_received = 0;
114
115static size_t num_received_long = 0;
116
117static size_t num_received_size = 0;
118 109
119static uint64_t avg_latency = 0; 110static uint64_t avg_latency = 0;
120 111
@@ -241,34 +232,17 @@ make_payload (size_t payload_size)
241static void 232static void
242latency_timeout (void *cls) 233latency_timeout (void *cls)
243{ 234{
244
245 size_t num_sent = 0;
246 size_t num_received = 0;
247
248 to_task = NULL; 235 to_task = NULL;
249 if (GNUNET_TIME_absolute_get_remaining (timeout).rel_value_us > 0) 236 if (GNUNET_TIME_absolute_get_remaining (timeout).rel_value_us > 0)
250 { 237 {
238 LOG (GNUNET_ERROR_TYPE_ERROR,
239 "Reschedule latency task\n");
251 to_task = GNUNET_SCHEDULER_add_at (timeout, 240 to_task = GNUNET_SCHEDULER_add_at (timeout,
252 &latency_timeout, 241 &latency_timeout,
253 NULL); 242 NULL);
254 return; 243 return;
255 } 244 }
256 245
257 switch (phase)
258 {
259 case TP_BURST_SHORT:
260 num_sent = num_sent_short;
261 num_received = num_received_short;
262 break;
263 case TP_BURST_LONG:
264 num_sent = num_sent_long;
265 num_received = num_received_long;
266 break;
267 case TP_SIZE_CHECK:
268 num_sent = num_sent_size;
269 num_received = num_received_size;
270 break;
271 }
272 LOG (GNUNET_ERROR_TYPE_ERROR, 246 LOG (GNUNET_ERROR_TYPE_ERROR,
273 "Latency too high. Test failed. (Phase: %d. Sent: %lu, Received: %lu)\n", 247 "Latency too high. Test failed. (Phase: %d. Sent: %lu, Received: %lu)\n",
274 phase, num_sent, num_received); 248 phase, num_sent, num_received);
@@ -276,8 +250,6 @@ latency_timeout (void *cls)
276 GNUNET_SCHEDULER_shutdown (); 250 GNUNET_SCHEDULER_shutdown ();
277} 251}
278 252
279/*static void
280 size_test (void *cls);*/
281 253
282static void 254static void
283size_test (void *cls) 255size_test (void *cls)
@@ -285,9 +257,6 @@ size_test (void *cls)
285 char *payload; 257 char *payload;
286 size_t max_size = 64000; 258 size_t max_size = 64000;
287 259
288 LOG (GNUNET_ERROR_TYPE_DEBUG,
289 "size_test_cb %u\n",
290 num_sent_size);
291 GNUNET_assert (TP_SIZE_CHECK == phase); 260 GNUNET_assert (TP_SIZE_CHECK == phase);
292 if (LONG_MESSAGE_SIZE != long_message_size) 261 if (LONG_MESSAGE_SIZE != long_message_size)
293 max_size = long_message_size; 262 max_size = long_message_size;
@@ -295,7 +264,7 @@ size_test (void *cls)
295 return; /* Leave some room for our protocol, so not 2^16 exactly */ 264 return; /* Leave some room for our protocol, so not 2^16 exactly */
296 ack += 10; 265 ack += 10;
297 payload = make_payload (ack); 266 payload = make_payload (ack);
298 num_sent_size++; 267 num_sent++;
299 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, 268 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
300 (ack < max_size) 269 (ack < max_size)
301 ? &size_test 270 ? &size_test
@@ -307,34 +276,17 @@ size_test (void *cls)
307 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS); 276 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
308} 277}
309 278
310/*static void
311size_test (void *cls)
312{
313 GNUNET_SCHEDULER_add_delayed (DELAY,
314 &size_test_cb,
315 NULL);
316 }*/
317
318static void
319long_test (void *cls);
320 279
321static void 280static void
322long_test_cb (void *cls) 281long_test (void *cls)
323{ 282{
324 char *payload; 283 char *payload;
325 284
326 LOG (GNUNET_ERROR_TYPE_DEBUG,
327 "long_test_cb %u/%u\n",
328 num_sent_long,
329 num_received_long);
330 payload = make_payload (long_message_size); 285 payload = make_payload (long_message_size);
331 num_sent_long++; 286 num_sent++;
332 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, 287 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
333 ((BURST_PACKETS 288 (BURST_PACKETS ==
334 * 0.91 == 289 num_sent)
335 num_received_long) ||
336 (BURST_PACKETS ==
337 num_sent_long))
338 ? NULL 290 ? NULL
339 : &long_test, 291 : &long_test,
340 NULL, 292 NULL,
@@ -344,37 +296,17 @@ long_test_cb (void *cls)
344 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS); 296 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
345} 297}
346 298
347static void
348long_test (void *cls)
349{
350 /*LOG (GNUNET_ERROR_TYPE_DEBUG,
351 "long_test %u\n",
352 num_sent_long);*/
353 GNUNET_SCHEDULER_add_delayed (DELAY,
354 &long_test_cb,
355 NULL);
356}
357 299
358static void 300static void
359short_test (void *cls); 301short_test (void *cls)
360
361static void
362short_test_cb (void *cls)
363{ 302{
364 char *payload; 303 char *payload;
365 304
366 LOG (GNUNET_ERROR_TYPE_DEBUG,
367 "short_test_cb %u/%u\n",
368 num_sent_short,
369 num_received_short);
370 payload = make_payload (SHORT_MESSAGE_SIZE); 305 payload = make_payload (SHORT_MESSAGE_SIZE);
371 num_sent_short++; 306 num_sent++;
372 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc, 307 GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
373 ((BURST_PACKETS 308 (BURST_PACKETS ==
374 * 0.91 == 309 num_sent)
375 num_received_short) ||
376 (BURST_PACKETS ==
377 num_sent_short))
378 ? NULL 310 ? NULL
379 : &short_test, 311 : &short_test,
380 NULL, 312 NULL,
@@ -384,14 +316,6 @@ short_test_cb (void *cls)
384 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS); 316 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
385} 317}
386 318
387static void
388short_test (void *cls)
389{
390 GNUNET_SCHEDULER_add_delayed (DELAY,
391 &short_test_cb,
392 NULL);
393}
394
395 319
396static int test_prepared = GNUNET_NO; 320static int test_prepared = GNUNET_NO;
397 321
@@ -453,12 +377,15 @@ add_queue_cb (void *cls,
453 else 377 else
454 long_message_size = LONG_MESSAGE_SIZE; 378 long_message_size = LONG_MESSAGE_SIZE;
455 phase = TP_BURST_SHORT; 379 phase = TP_BURST_SHORT;
456 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES); 380 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply (
381 GNUNET_TIME_UNIT_SECONDS, 2));
457 GNUNET_assert (NULL == to_task); 382 GNUNET_assert (NULL == to_task);
458 to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, 383 to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (
384 GNUNET_TIME_UNIT_SECONDS, 2),
459 &latency_timeout, 385 &latency_timeout,
460 NULL); 386 NULL);
461 prepare_test (NULL); 387 // prepare_test (NULL);
388 short_test (NULL);
462} 389}
463 390
464 391
@@ -468,23 +395,10 @@ update_avg_latency (const char*payload)
468 struct GNUNET_TIME_AbsoluteNBO *ts_n; 395 struct GNUNET_TIME_AbsoluteNBO *ts_n;
469 struct GNUNET_TIME_Absolute ts; 396 struct GNUNET_TIME_Absolute ts;
470 struct GNUNET_TIME_Relative latency; 397 struct GNUNET_TIME_Relative latency;
471 size_t num_received = 0;
472 398
473 ts_n = (struct GNUNET_TIME_AbsoluteNBO *) payload; 399 ts_n = (struct GNUNET_TIME_AbsoluteNBO *) payload;
474 ts = GNUNET_TIME_absolute_ntoh (*ts_n); 400 ts = GNUNET_TIME_absolute_ntoh (*ts_n);
475 latency = GNUNET_TIME_absolute_get_duration (ts); 401 latency = GNUNET_TIME_absolute_get_duration (ts);
476 switch (phase)
477 {
478 case TP_BURST_SHORT:
479 num_received = num_received_short;
480 break;
481 case TP_BURST_LONG:
482 num_received = num_received_long;
483 break;
484 case TP_SIZE_CHECK:
485 num_received = num_received_size;
486 break;
487 }
488 if (1 >= num_received) 402 if (1 >= num_received)
489 avg_latency = latency.rel_value_us; 403 avg_latency = latency.rel_value_us;
490 else 404 else
@@ -493,6 +407,7 @@ update_avg_latency (const char*payload)
493 407
494} 408}
495 409
410
496/** 411/**
497 * @brief Handle an incoming message 412 * @brief Handle an incoming message
498 * 413 *
@@ -504,8 +419,7 @@ update_avg_latency (const char*payload)
504 */ 419 */
505static void 420static void
506incoming_message_cb (void *cls, 421incoming_message_cb (void *cls,
507 struct 422 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle
508 GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle
509 *tc_h, 423 *tc_h,
510 const char*payload, 424 const char*payload,
511 size_t payload_len) 425 size_t payload_len)
@@ -516,6 +430,8 @@ incoming_message_cb (void *cls,
516 "unexpected receiver...\n"); 430 "unexpected receiver...\n");
517 return; 431 return;
518 } 432 }
433 LOG (GNUNET_ERROR_TYPE_DEBUG,
434 "Incomming message\n");
519 /* Reset timeout */ 435 /* Reset timeout */
520 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS); 436 timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
521 switch (phase) 437 switch (phase)
@@ -526,31 +442,30 @@ incoming_message_cb (void *cls,
526 case TP_BURST_SHORT: 442 case TP_BURST_SHORT:
527 { 443 {
528 GNUNET_assert (SHORT_MESSAGE_SIZE == payload_len); 444 GNUNET_assert (SHORT_MESSAGE_SIZE == payload_len);
529 num_received_short++; 445 num_received++;
530 duration = GNUNET_TIME_absolute_get_duration (start_short); 446 duration = GNUNET_TIME_absolute_get_duration (start_short);
531 update_avg_latency (payload); 447 update_avg_latency (payload);
532 if (num_received_short == BURST_PACKETS * 0.91) 448 if (num_received == BURST_PACKETS * DROP_RATIO)
533 { 449 {
534 LOG (GNUNET_ERROR_TYPE_MESSAGE, 450 LOG (GNUNET_ERROR_TYPE_MESSAGE,
535 "Short size packet test done.\n"); 451 "Short size packet test done.\n");
536 char *goodput = GNUNET_STRINGS_byte_size_fancy ((SHORT_MESSAGE_SIZE 452 char *goodput = GNUNET_STRINGS_byte_size_fancy ((SHORT_MESSAGE_SIZE
537 * num_received_short 453 * num_received * 1000
538 * 1000
539 * 1000) 454 * 1000)
540 / duration.rel_value_us); 455 / duration.rel_value_us);
541 LOG (GNUNET_ERROR_TYPE_MESSAGE, 456 LOG (GNUNET_ERROR_TYPE_MESSAGE,
542 "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", 457 "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n",
543 (unsigned long) num_received_short, 458 (unsigned long) num_received,
544 (unsigned long) num_sent_short, 459 (unsigned long) num_sent,
545 (unsigned long long) duration.rel_value_us, 460 (unsigned long long) duration.rel_value_us,
546 goodput, 461 goodput,
547 (unsigned long long) avg_latency); 462 (unsigned long long) avg_latency);
548 GNUNET_free (goodput); 463 GNUNET_free (goodput);
549 start_long = GNUNET_TIME_absolute_get (); 464 start_long = GNUNET_TIME_absolute_get ();
550 phase = TP_BURST_LONG; 465 phase = TP_BURST_LONG;
551 // num_sent_short = 0; 466 num_sent = 0;
552 avg_latency = 0; 467 avg_latency = 0;
553 // num_received = 0; 468 num_received = 0;
554 long_test (NULL); 469 long_test (NULL);
555 } 470 }
556 break; 471 break;
@@ -561,34 +476,32 @@ incoming_message_cb (void *cls,
561 { 476 {
562 LOG (GNUNET_ERROR_TYPE_WARNING, 477 LOG (GNUNET_ERROR_TYPE_WARNING,
563 "Ignoring packet with wrong length\n"); 478 "Ignoring packet with wrong length\n");
564 return; // Ignore 479 return; // Ignore
565 } 480 }
566 num_received_long++; 481 num_received++;
567 duration = GNUNET_TIME_absolute_get_duration (start_long); 482 duration = GNUNET_TIME_absolute_get_duration (start_long);
568 update_avg_latency (payload); 483 update_avg_latency (payload);
569 if (num_received_long == BURST_PACKETS * 0.91) 484 if (num_received == BURST_PACKETS * DROP_RATIO)
570 { 485 {
571 LOG (GNUNET_ERROR_TYPE_MESSAGE, 486 LOG (GNUNET_ERROR_TYPE_MESSAGE,
572 "Long size packet test done.\n"); 487 "Long size packet test done.\n");
573 char *goodput = GNUNET_STRINGS_byte_size_fancy ((long_message_size 488 char *goodput = GNUNET_STRINGS_byte_size_fancy ((long_message_size
574 * num_received_long 489 * num_received * 1000
575 * 1000
576 * 1000) 490 * 1000)
577 / duration. 491 / duration.rel_value_us);
578 rel_value_us);
579 492
580 LOG (GNUNET_ERROR_TYPE_MESSAGE, 493 LOG (GNUNET_ERROR_TYPE_MESSAGE,
581 "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", 494 "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n",
582 (unsigned long) num_received_long, 495 (unsigned long) num_received,
583 (unsigned long) num_sent_long, 496 (unsigned long) num_sent,
584 (unsigned long long) duration.rel_value_us, 497 (unsigned long long) duration.rel_value_us,
585 goodput, 498 goodput,
586 (unsigned long long) avg_latency); 499 (unsigned long long) avg_latency);
587 GNUNET_free (goodput); 500 GNUNET_free (goodput);
588 ack = 0; 501 ack = 0;
589 phase = TP_SIZE_CHECK; 502 phase = TP_SIZE_CHECK;
590 // num_received = 0; 503 num_received = 0;
591 // num_sent_long = 0; 504 num_sent = 0;
592 avg_latency = 0; 505 avg_latency = 0;
593 size_test (NULL); 506 size_test (NULL);
594 } 507 }
@@ -601,29 +514,25 @@ incoming_message_cb (void *cls,
601 GNUNET_assert (TP_SIZE_CHECK == phase); 514 GNUNET_assert (TP_SIZE_CHECK == phase);
602 if (LONG_MESSAGE_SIZE != long_message_size) 515 if (LONG_MESSAGE_SIZE != long_message_size)
603 max_size = long_message_size; 516 max_size = long_message_size;
604 num_received_size++; 517 num_received++;
605 update_avg_latency (payload); 518 update_avg_latency (payload);
606 if (num_received_size >= (max_size) / 10) 519 if (num_received >= (max_size) / 10)
607 { 520 {
608 LOG (GNUNET_ERROR_TYPE_MESSAGE, 521 LOG (GNUNET_ERROR_TYPE_MESSAGE,
609 "Size packet test done.\n"); 522 "Size packet test done.\n");
610 LOG (GNUNET_ERROR_TYPE_MESSAGE, 523 LOG (GNUNET_ERROR_TYPE_MESSAGE,
611 "%lu/%lu packets -- avg latency: %llu us\n", 524 "%lu/%lu packets -- avg latency: %llu us\n",
612 (unsigned long) num_received_size, 525 (unsigned long) num_received,
613 (unsigned long) num_sent_size, 526 (unsigned long) num_sent,
614 (unsigned long long) avg_latency); 527 (unsigned long long) avg_latency);
615 num_received_size = 0; 528 num_received = 0;
616 num_sent_size = 0; 529 num_sent = 0;
617 avg_latency = 0; 530 avg_latency = 0;
618 iterations_left--; 531 iterations_left--;
619 if (0 != iterations_left) 532 if (0 != iterations_left)
620 { 533 {
621 start_short = GNUNET_TIME_absolute_get (); 534 start_short = GNUNET_TIME_absolute_get ();
622 phase = TP_BURST_SHORT; 535 phase = TP_BURST_SHORT;
623 num_sent_short = 0;
624 num_sent_long = 0;
625 num_received_short = 0;
626 num_received_long = 0;
627 short_test (NULL); 536 short_test (NULL);
628 break; 537 break;
629 } 538 }
@@ -661,8 +570,8 @@ static void
661run (void *cls) 570run (void *cls)
662{ 571{
663 ret = 0; 572 ret = 0;
664 // num_received = 0; 573 num_received = 0;
665 // num_sent = 0; 574 num_sent = 0;
666 for (unsigned int i = 0; i < NUM_PEERS; i++) 575 for (unsigned int i = 0; i < NUM_PEERS; i++)
667 { 576 {
668 tc_hs[i] = GNUNET_TRANSPORT_TESTING_transport_communicator_service_start ( 577 tc_hs[i] = GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index 98cfd5e29..baafff249 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -553,7 +553,10 @@ handle_update_queue_message (void *cls,
553 tc_queue->mtu = ntohl (msg->mtu); 553 tc_queue->mtu = ntohl (msg->mtu);
554 tc_queue->cs = msg->cs; 554 tc_queue->cs = msg->cs;
555 tc_queue->priority = ntohl (msg->priority); 555 tc_queue->priority = ntohl (msg->priority);
556 tc_queue->q_len += GNUNET_ntohll (msg->q_len); 556 // Uncomment this for alternativ 1 of backchannel functionality
557 // tc_queue->q_len += GNUNET_ntohll (msg->q_len);
558 // Uncomment this for alternativ 2 of backchannel functionality
559 tc_queue->q_len = GNUNET_ntohll (msg->q_len);
557 GNUNET_SERVICE_client_continue (client->client); 560 GNUNET_SERVICE_client_continue (client->client);
558} 561}
559 562
@@ -1130,8 +1133,9 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_send
1130 } 1133 }
1131 } 1134 }
1132 GNUNET_assert (NULL != tc_queue); 1135 GNUNET_assert (NULL != tc_queue);
1133 if (tc_queue->q_len != GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED) 1136 // Uncomment this for alternativ 1 of backchannel functionality
1134 tc_queue->q_len--; 1137 /*if (tc_queue->q_len != GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED)
1138 tc_queue->q_len--;*/
1135 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1139 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1136 "Sending message\n"); 1140 "Sending message\n");
1137 inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size; 1141 inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size;