diff options
Diffstat (limited to 'auto_tests/TCP_test.c')
-rw-r--r-- | auto_tests/TCP_test.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/auto_tests/TCP_test.c b/auto_tests/TCP_test.c index 5c656541..898c5e08 100644 --- a/auto_tests/TCP_test.c +++ b/auto_tests/TCP_test.c | |||
@@ -35,7 +35,7 @@ START_TEST(test_basic) | |||
35 | Socket sock = net_socket(TOX_AF_INET6, TOX_SOCK_STREAM, TOX_PROTO_TCP); | 35 | Socket sock = net_socket(TOX_AF_INET6, TOX_SOCK_STREAM, TOX_PROTO_TCP); |
36 | IP_Port ip_port_loopback; | 36 | IP_Port ip_port_loopback; |
37 | ip_port_loopback.ip.family = TOX_AF_INET6; | 37 | ip_port_loopback.ip.family = TOX_AF_INET6; |
38 | ip_port_loopback.ip.ip6 = IP6_LOOPBACK; | 38 | ip_port_loopback.ip.ip6 = get_ip6_loopback(); |
39 | ip_port_loopback.port = net_htons(ports[rand() % NUM_PORTS]); | 39 | ip_port_loopback.port = net_htons(ports[rand() % NUM_PORTS]); |
40 | 40 | ||
41 | int ret = net_connect(sock, ip_port_loopback); | 41 | int ret = net_connect(sock, ip_port_loopback); |
@@ -135,8 +135,7 @@ static struct sec_TCP_con *new_TCP_con(TCP_Server *tcp_s) | |||
135 | IP_Port ip_port_loopback; | 135 | IP_Port ip_port_loopback; |
136 | ip_port_loopback.ip.family = TOX_AF_INET6; | 136 | ip_port_loopback.ip.family = TOX_AF_INET6; |
137 | ip_port_loopback.ip.ip6.uint64[0] = 0; | 137 | ip_port_loopback.ip.ip6.uint64[0] = 0; |
138 | ip_port_loopback.ip.ip6.uint64[1] = 0; | 138 | ip_port_loopback.ip.ip4 = get_ip4_loopback(); |
139 | ip_port_loopback.ip.ip6.uint8[15] = 1; // ::1 | ||
140 | ip_port_loopback.port = net_htons(ports[rand() % NUM_PORTS]); | 139 | ip_port_loopback.port = net_htons(ports[rand() % NUM_PORTS]); |
141 | 140 | ||
142 | int ret = net_connect(sock, ip_port_loopback); | 141 | int ret = net_connect(sock, ip_port_loopback); |
@@ -404,7 +403,7 @@ START_TEST(test_client) | |||
404 | 403 | ||
405 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); | 404 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); |
406 | ip_port_tcp_s.ip.family = TOX_AF_INET6; | 405 | ip_port_tcp_s.ip.family = TOX_AF_INET6; |
407 | ip_port_tcp_s.ip.ip6 = IP6_LOOPBACK; | 406 | ip_port_tcp_s.ip.ip6 = get_ip6_loopback(); |
408 | TCP_Client_Connection *conn = new_TCP_connection(ip_port_tcp_s, self_public_key, f_public_key, f_secret_key, 0); | 407 | TCP_Client_Connection *conn = new_TCP_connection(ip_port_tcp_s, self_public_key, f_public_key, f_secret_key, 0); |
409 | c_sleep(50); | 408 | c_sleep(50); |
410 | do_TCP_connection(conn, NULL); | 409 | do_TCP_connection(conn, NULL); |
@@ -502,7 +501,7 @@ START_TEST(test_client_invalid) | |||
502 | 501 | ||
503 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); | 502 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); |
504 | ip_port_tcp_s.ip.family = TOX_AF_INET6; | 503 | ip_port_tcp_s.ip.family = TOX_AF_INET6; |
505 | ip_port_tcp_s.ip.ip6 = IP6_LOOPBACK; | 504 | ip_port_tcp_s.ip.ip6 = get_ip6_loopback(); |
506 | TCP_Client_Connection *conn = new_TCP_connection(ip_port_tcp_s, self_public_key, f_public_key, f_secret_key, 0); | 505 | TCP_Client_Connection *conn = new_TCP_connection(ip_port_tcp_s, self_public_key, f_public_key, f_secret_key, 0); |
507 | c_sleep(50); | 506 | c_sleep(50); |
508 | do_TCP_connection(conn, NULL); | 507 | do_TCP_connection(conn, NULL); |
@@ -571,7 +570,7 @@ START_TEST(test_tcp_connection) | |||
571 | 570 | ||
572 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); | 571 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); |
573 | ip_port_tcp_s.ip.family = TOX_AF_INET6; | 572 | ip_port_tcp_s.ip.family = TOX_AF_INET6; |
574 | ip_port_tcp_s.ip.ip6 = IP6_LOOPBACK; | 573 | ip_port_tcp_s.ip.ip6 = get_ip6_loopback(); |
575 | 574 | ||
576 | int connection = new_tcp_connection_to(tc_1, tcp_connections_public_key(tc_2), 123); | 575 | int connection = new_tcp_connection_to(tc_1, tcp_connections_public_key(tc_2), 123); |
577 | ck_assert_msg(connection == 0, "Connection id wrong"); | 576 | ck_assert_msg(connection == 0, "Connection id wrong"); |
@@ -680,7 +679,7 @@ START_TEST(test_tcp_connection2) | |||
680 | 679 | ||
681 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); | 680 | ip_port_tcp_s.port = net_htons(ports[rand() % NUM_PORTS]); |
682 | ip_port_tcp_s.ip.family = TOX_AF_INET6; | 681 | ip_port_tcp_s.ip.family = TOX_AF_INET6; |
683 | ip_port_tcp_s.ip.ip6 = IP6_LOOPBACK; | 682 | ip_port_tcp_s.ip.ip6 = get_ip6_loopback(); |
684 | 683 | ||
685 | int connection = new_tcp_connection_to(tc_1, tcp_connections_public_key(tc_2), 123); | 684 | int connection = new_tcp_connection_to(tc_1, tcp_connections_public_key(tc_2), 123); |
686 | ck_assert_msg(connection == 0, "Connection id wrong"); | 685 | ck_assert_msg(connection == 0, "Connection id wrong"); |