summaryrefslogtreecommitdiff
path: root/auto_tests/TCP_test.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-21 20:23:46 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-22 16:42:36 +0100
commit18b298a3d690d0691e7002977ba83b3965f78510 (patch)
tree343d6369ce797bd94630fc8222cb1ab3eaab8e23 /auto_tests/TCP_test.c
parentfd50660f407bf3457c4c5ae943c3978aa6054bba (diff)
Make TCP_Connections module-private.
Diffstat (limited to 'auto_tests/TCP_test.c')
-rw-r--r--auto_tests/TCP_test.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/auto_tests/TCP_test.c b/auto_tests/TCP_test.c
index 7f96ef35..6a721b43 100644
--- a/auto_tests/TCP_test.c
+++ b/auto_tests/TCP_test.c
@@ -560,11 +560,11 @@ START_TEST(test_tcp_connection)
560 proxy_info.proxy_type = TCP_PROXY_NONE; 560 proxy_info.proxy_type = TCP_PROXY_NONE;
561 crypto_box_keypair(self_public_key, self_secret_key); 561 crypto_box_keypair(self_public_key, self_secret_key);
562 TCP_Connections *tc_1 = new_tcp_connections(self_secret_key, &proxy_info); 562 TCP_Connections *tc_1 = new_tcp_connections(self_secret_key, &proxy_info);
563 ck_assert_msg(public_key_cmp(tc_1->self_public_key, self_public_key) == 0, "Wrong public key"); 563 ck_assert_msg(public_key_cmp(tcp_connections_public_key(tc_1), self_public_key) == 0, "Wrong public key");
564 564
565 crypto_box_keypair(self_public_key, self_secret_key); 565 crypto_box_keypair(self_public_key, self_secret_key);
566 TCP_Connections *tc_2 = new_tcp_connections(self_secret_key, &proxy_info); 566 TCP_Connections *tc_2 = new_tcp_connections(self_secret_key, &proxy_info);
567 ck_assert_msg(public_key_cmp(tc_2->self_public_key, self_public_key) == 0, "Wrong public key"); 567 ck_assert_msg(public_key_cmp(tcp_connections_public_key(tc_2), self_public_key) == 0, "Wrong public key");
568 568
569 IP_Port ip_port_tcp_s; 569 IP_Port ip_port_tcp_s;
570 570
@@ -572,18 +572,19 @@ START_TEST(test_tcp_connection)
572 ip_port_tcp_s.ip.family = AF_INET6; 572 ip_port_tcp_s.ip.family = AF_INET6;
573 ip_port_tcp_s.ip.ip6.in6_addr = in6addr_loopback; 573 ip_port_tcp_s.ip.ip6.in6_addr = in6addr_loopback;
574 574
575 int connection = new_tcp_connection_to(tc_1, tc_2->self_public_key, 123); 575 int connection = new_tcp_connection_to(tc_1, tcp_connections_public_key(tc_2), 123);
576 ck_assert_msg(connection == 0, "Connection id wrong"); 576 ck_assert_msg(connection == 0, "Connection id wrong");
577 ck_assert_msg(add_tcp_relay_connection(tc_1, connection, ip_port_tcp_s, tcp_server_public_key(tcp_s)) == 0, 577 ck_assert_msg(add_tcp_relay_connection(tc_1, connection, ip_port_tcp_s, tcp_server_public_key(tcp_s)) == 0,
578 "Could not add tcp relay to connection\n"); 578 "Could not add tcp relay to connection\n");
579 579
580 ip_port_tcp_s.port = htons(ports[rand() % NUM_PORTS]); 580 ip_port_tcp_s.port = htons(ports[rand() % NUM_PORTS]);
581 connection = new_tcp_connection_to(tc_2, tc_1->self_public_key, 123); 581 connection = new_tcp_connection_to(tc_2, tcp_connections_public_key(tc_1), 123);
582 ck_assert_msg(connection == 0, "Connection id wrong"); 582 ck_assert_msg(connection == 0, "Connection id wrong");
583 ck_assert_msg(add_tcp_relay_connection(tc_2, connection, ip_port_tcp_s, tcp_server_public_key(tcp_s)) == 0, 583 ck_assert_msg(add_tcp_relay_connection(tc_2, connection, ip_port_tcp_s, tcp_server_public_key(tcp_s)) == 0,
584 "Could not add tcp relay to connection\n"); 584 "Could not add tcp relay to connection\n");
585 585
586 ck_assert_msg(new_tcp_connection_to(tc_2, tc_1->self_public_key, 123) == -1, "Managed to readd same connection\n"); 586 ck_assert_msg(new_tcp_connection_to(tc_2, tcp_connections_public_key(tc_1), 123) == -1,
587 "Managed to readd same connection\n");
587 588
588 c_sleep(50); 589 c_sleep(50);
589 do_TCP_server(tcp_s); 590 do_TCP_server(tcp_s);
@@ -666,11 +667,11 @@ START_TEST(test_tcp_connection2)
666 proxy_info.proxy_type = TCP_PROXY_NONE; 667 proxy_info.proxy_type = TCP_PROXY_NONE;
667 crypto_box_keypair(self_public_key, self_secret_key); 668 crypto_box_keypair(self_public_key, self_secret_key);
668 TCP_Connections *tc_1 = new_tcp_connections(self_secret_key, &proxy_info); 669 TCP_Connections *tc_1 = new_tcp_connections(self_secret_key, &proxy_info);
669 ck_assert_msg(public_key_cmp(tc_1->self_public_key, self_public_key) == 0, "Wrong public key"); 670 ck_assert_msg(public_key_cmp(tcp_connections_public_key(tc_1), self_public_key) == 0, "Wrong public key");
670 671
671 crypto_box_keypair(self_public_key, self_secret_key); 672 crypto_box_keypair(self_public_key, self_secret_key);
672 TCP_Connections *tc_2 = new_tcp_connections(self_secret_key, &proxy_info); 673 TCP_Connections *tc_2 = new_tcp_connections(self_secret_key, &proxy_info);
673 ck_assert_msg(public_key_cmp(tc_2->self_public_key, self_public_key) == 0, "Wrong public key"); 674 ck_assert_msg(public_key_cmp(tcp_connections_public_key(tc_2), self_public_key) == 0, "Wrong public key");
674 675
675 IP_Port ip_port_tcp_s; 676 IP_Port ip_port_tcp_s;
676 677
@@ -678,7 +679,7 @@ START_TEST(test_tcp_connection2)
678 ip_port_tcp_s.ip.family = AF_INET6; 679 ip_port_tcp_s.ip.family = AF_INET6;
679 ip_port_tcp_s.ip.ip6.in6_addr = in6addr_loopback; 680 ip_port_tcp_s.ip.ip6.in6_addr = in6addr_loopback;
680 681
681 int connection = new_tcp_connection_to(tc_1, tc_2->self_public_key, 123); 682 int connection = new_tcp_connection_to(tc_1, tcp_connections_public_key(tc_2), 123);
682 ck_assert_msg(connection == 0, "Connection id wrong"); 683 ck_assert_msg(connection == 0, "Connection id wrong");
683 ck_assert_msg(add_tcp_relay_connection(tc_1, connection, ip_port_tcp_s, tcp_server_public_key(tcp_s)) == 0, 684 ck_assert_msg(add_tcp_relay_connection(tc_1, connection, ip_port_tcp_s, tcp_server_public_key(tcp_s)) == 0,
684 "Could not add tcp relay to connection\n"); 685 "Could not add tcp relay to connection\n");