port 0 hack for the API unit test
This commit is contained in:
parent
c671f1c663
commit
ceb4a8f568
22
tests/api.c
22
tests/api.c
@ -929,6 +929,7 @@ static int test_CyaSSL_read_write(void)
|
||||
|
||||
InitTcpReady(&ready);
|
||||
server_args.signal = &ready;
|
||||
client_args.signal = &ready;
|
||||
start_thread(test_server_nofail, &server_args, &serverThread);
|
||||
wait_tcp_ready(&server_args);
|
||||
test_client_nofail(&client_args);
|
||||
@ -956,6 +957,7 @@ THREAD_RETURN CYASSL_THREAD test_server_nofail(void* args)
|
||||
{
|
||||
SOCKET_T sockfd = 0;
|
||||
SOCKET_T clientfd = 0;
|
||||
word16 port = yasslPort;
|
||||
|
||||
CYASSL_METHOD* method = 0;
|
||||
CYASSL_CTX* ctx = 0;
|
||||
@ -969,6 +971,11 @@ THREAD_RETURN CYASSL_THREAD test_server_nofail(void* args)
|
||||
method = CyaSSLv23_server_method();
|
||||
ctx = CyaSSL_CTX_new(method);
|
||||
|
||||
#if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && \
|
||||
!defined(CYASSL_SNIFFER) && !defined(CYASSL_MDK_SHELL)
|
||||
port = 0;
|
||||
#endif
|
||||
|
||||
CyaSSL_CTX_set_verify(ctx,
|
||||
SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0);
|
||||
|
||||
@ -996,7 +1003,7 @@ THREAD_RETURN CYASSL_THREAD test_server_nofail(void* args)
|
||||
goto done;
|
||||
}
|
||||
ssl = CyaSSL_new(ctx);
|
||||
tcp_accept(&sockfd, &clientfd, (func_args*)args, yasslPort, 0, 0);
|
||||
tcp_accept(&sockfd, &clientfd, (func_args*)args, port, 0, 0);
|
||||
CloseSocket(sockfd);
|
||||
|
||||
CyaSSL_set_fd(ssl, clientfd);
|
||||
@ -1080,7 +1087,7 @@ void test_client_nofail(void* args)
|
||||
goto done2;
|
||||
}
|
||||
|
||||
tcp_connect(&sockfd, yasslIP, yasslPort, 0);
|
||||
tcp_connect(&sockfd, yasslIP, ((func_args*)args)->signal->port, 0);
|
||||
|
||||
ssl = CyaSSL_new(ctx);
|
||||
CyaSSL_set_fd(ssl, sockfd);
|
||||
@ -1145,7 +1152,7 @@ void run_cyassl_client(void* args)
|
||||
if (callbacks->ctx_ready)
|
||||
callbacks->ctx_ready(ctx);
|
||||
|
||||
tcp_connect(&sfd, yasslIP, yasslPort, 0);
|
||||
tcp_connect(&sfd, yasslIP, ((func_args*)args)->signal->port, 0);
|
||||
|
||||
ssl = CyaSSL_new(ctx);
|
||||
CyaSSL_set_fd(ssl, sfd);
|
||||
@ -1184,6 +1191,7 @@ THREAD_RETURN CYASSL_THREAD run_cyassl_server(void* args)
|
||||
CYASSL* ssl = NULL;
|
||||
SOCKET_T sfd = 0;
|
||||
SOCKET_T cfd = 0;
|
||||
word16 port = yasslPort;
|
||||
|
||||
char msg[] = "I hear you fa shizzle!";
|
||||
int len = (int) XSTRLEN(msg);
|
||||
@ -1192,6 +1200,11 @@ THREAD_RETURN CYASSL_THREAD run_cyassl_server(void* args)
|
||||
|
||||
((func_args*)args)->return_code = TEST_FAIL;
|
||||
|
||||
#if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && \
|
||||
!defined(CYASSL_SNIFFER) && !defined(CYASSL_MDK_SHELL)
|
||||
port = 0;
|
||||
#endif
|
||||
|
||||
CyaSSL_CTX_set_verify(ctx,
|
||||
SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0);
|
||||
|
||||
@ -1213,7 +1226,7 @@ THREAD_RETURN CYASSL_THREAD run_cyassl_server(void* args)
|
||||
|
||||
ssl = CyaSSL_new(ctx);
|
||||
|
||||
tcp_accept(&sfd, &cfd, (func_args*)args, yasslPort, 0, 0);
|
||||
tcp_accept(&sfd, &cfd, (func_args*)args, port, 0, 0);
|
||||
CloseSocket(sfd);
|
||||
|
||||
CyaSSL_set_fd(ssl, cfd);
|
||||
@ -1274,6 +1287,7 @@ void test_CyaSSL_client_server(callback_functions* client_callbacks,
|
||||
/* RUN Server side */
|
||||
InitTcpReady(&ready);
|
||||
server_args.signal = &ready;
|
||||
client_args.signal = &ready;
|
||||
start_thread(run_cyassl_server, &server_args, &serverThread);
|
||||
wait_tcp_ready(&server_args);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user