@@ -737,6 +737,9 @@ static void test_tcp_connection(void)
737
737
Mono_Time * mono_time = mono_time_new (mem , nullptr , nullptr );
738
738
Logger * logger = logger_new (mem );
739
739
740
+ Net_Profile * tcp_np = netprof_new (logger , mem );
741
+ ck_assert (tcp_np != nullptr );
742
+
740
743
tcp_data_callback_called = 0 ;
741
744
uint8_t self_public_key [CRYPTO_PUBLIC_KEY_SIZE ];
742
745
uint8_t self_secret_key [CRYPTO_SECRET_KEY_SIZE ];
@@ -747,12 +750,12 @@ static void test_tcp_connection(void)
747
750
TCP_Proxy_Info proxy_info ;
748
751
proxy_info .proxy_type = TCP_PROXY_NONE ;
749
752
crypto_new_keypair (rng , self_public_key , self_secret_key );
750
- TCP_Connections * tc_1 = new_tcp_connections (logger , mem , rng , ns , mono_time , self_secret_key , & proxy_info );
753
+ TCP_Connections * tc_1 = new_tcp_connections (logger , mem , rng , ns , mono_time , self_secret_key , & proxy_info , tcp_np );
751
754
ck_assert_msg (tc_1 != nullptr , "Failed to create TCP connections" );
752
755
ck_assert_msg (pk_equal (tcp_connections_public_key (tc_1 ), self_public_key ), "Wrong public key" );
753
756
754
757
crypto_new_keypair (rng , self_public_key , self_secret_key );
755
- TCP_Connections * tc_2 = new_tcp_connections (logger , mem , rng , ns , mono_time , self_secret_key , & proxy_info );
758
+ TCP_Connections * tc_2 = new_tcp_connections (logger , mem , rng , ns , mono_time , self_secret_key , & proxy_info , tcp_np );
756
759
ck_assert_msg (tc_2 != nullptr , "Failed to create TCP connections" );
757
760
ck_assert_msg (pk_equal (tcp_connections_public_key (tc_2 ), self_public_key ), "Wrong public key" );
758
761
@@ -811,6 +814,8 @@ static void test_tcp_connection(void)
811
814
ck_assert_msg (send_packet_tcp_connection (tc_1 , 0 , (const uint8_t * )"Gentoo" , 6 ) == -1 , "could send packet." );
812
815
ck_assert_msg (kill_tcp_connection_to (tc_2 , 0 ) == 0 , "could not kill connection to\n" );
813
816
817
+ netprof_kill (tcp_np );
818
+
814
819
kill_tcp_server (tcp_s );
815
820
kill_tcp_connections (tc_1 );
816
821
kill_tcp_connections (tc_2 );
@@ -852,6 +857,9 @@ static void test_tcp_connection2(void)
852
857
Mono_Time * mono_time = mono_time_new (mem , nullptr , nullptr );
853
858
Logger * logger = logger_new (mem );
854
859
860
+ Net_Profile * tcp_np = netprof_new (logger , mem );
861
+ ck_assert (tcp_np != nullptr );
862
+
855
863
tcp_oobdata_callback_called = 0 ;
856
864
tcp_data_callback_called = 0 ;
857
865
@@ -864,12 +872,12 @@ static void test_tcp_connection2(void)
864
872
TCP_Proxy_Info proxy_info ;
865
873
proxy_info .proxy_type = TCP_PROXY_NONE ;
866
874
crypto_new_keypair (rng , self_public_key , self_secret_key );
867
- TCP_Connections * tc_1 = new_tcp_connections (logger , mem , rng , ns , mono_time , self_secret_key , & proxy_info );
875
+ TCP_Connections * tc_1 = new_tcp_connections (logger , mem , rng , ns , mono_time , self_secret_key , & proxy_info , tcp_np );
868
876
ck_assert_msg (tc_1 != nullptr , "Failed to create TCP connections" );
869
877
ck_assert_msg (pk_equal (tcp_connections_public_key (tc_1 ), self_public_key ), "Wrong public key" );
870
878
871
879
crypto_new_keypair (rng , self_public_key , self_secret_key );
872
- TCP_Connections * tc_2 = new_tcp_connections (logger , mem , rng , ns , mono_time , self_secret_key , & proxy_info );
880
+ TCP_Connections * tc_2 = new_tcp_connections (logger , mem , rng , ns , mono_time , self_secret_key , & proxy_info , tcp_np );
873
881
ck_assert_msg (tc_2 != nullptr , "Failed to create TCP connections" );
874
882
ck_assert_msg (pk_equal (tcp_connections_public_key (tc_2 ), self_public_key ), "Wrong public key" );
875
883
@@ -921,6 +929,8 @@ static void test_tcp_connection2(void)
921
929
ck_assert_msg (tcp_data_callback_called , "could not recv packet." );
922
930
ck_assert_msg (kill_tcp_connection_to (tc_1 , 0 ) == 0 , "could not kill connection to\n" );
923
931
932
+ netprof_kill (tcp_np );
933
+
924
934
kill_tcp_server (tcp_s );
925
935
kill_tcp_connections (tc_1 );
926
936
kill_tcp_connections (tc_2 );
0 commit comments