forked from wolfSSL/wolfssl
MinGW fixes, server port assigning cleanup and ping test cleanup. Fixes issue with visibility detection with MinGW. The visibility.m4 script was not actually trying to call the hidden function, which caused MinGW to detect improperly that visibility was supported. Fix for bogusFile on Windows build. Fixes to build warnings for unused variable 'res' and signed/unsigned comparison for sizeof min(). Cleanup of the server side port assignment to allow use with Windows/MinGW/Cygwin. If Windows uses new GetRandomPort() function in test.h to get port in in the 49152 - 65535 range. If *nix then uses the tcp_listen returned port. Otherwise uses the default wolfSSLPort. Refactor of the ping test code to use common file and properly handle ping count differences (Windows "-c" vs. *Nix style "-n"). Workaround for MinGW and cyassl/options.h getting file permissions error. Added non-fatal compile warning if using MinGW that "strtok_s" might be missing along with a link to public domain source that can be used.
This commit is contained in:
committed by
Jacob Barthelmeh
parent
255d9ecfb3
commit
993972162e
@@ -84,7 +84,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
int outCreated = 0;
|
||||
int shutDown = 0;
|
||||
int useAnyAddr = 0;
|
||||
word16 port = wolfSSLPort;
|
||||
word16 port;
|
||||
int argc = ((func_args*)args)->argc;
|
||||
char** argv = ((func_args*)args)->argv;
|
||||
|
||||
@@ -114,14 +114,21 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
doPSK = 1;
|
||||
#endif
|
||||
|
||||
#if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && \
|
||||
!defined(CYASSL_SNIFFER) && !defined(WOLFSSL_MDK_SHELL) && \
|
||||
!defined(CYASSL_TIRTOS)
|
||||
port = 0;
|
||||
#endif
|
||||
#if defined(USE_ANY_ADDR)
|
||||
useAnyAddr = 1;
|
||||
#endif
|
||||
#if defined(USE_WINDOWS_API)
|
||||
/* Generate random port for testing */
|
||||
port = GetRandomPort();
|
||||
#elif defined(NO_MAIN_DRIVER) && !defined(CYASSL_SNIFFER) && \
|
||||
!defined(WOLFSSL_MDK_SHELL) && !defined(CYASSL_TIRTOS)
|
||||
/* Let tcp_listen assign port */
|
||||
port = 0;
|
||||
#else
|
||||
/* Use default port */
|
||||
port = wolfSSLPort;
|
||||
#endif
|
||||
|
||||
#if defined(USE_ANY_ADDR)
|
||||
useAnyAddr = 1;
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_TIRTOS
|
||||
fdOpenSession(Task_self());
|
||||
|
||||
@@ -398,10 +398,6 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
|
||||
case 'p' :
|
||||
port = (word16)atoi(myoptarg);
|
||||
#if defined(USE_WINDOWS_API)
|
||||
if (port == 0)
|
||||
err_sys("port number cannot be 0");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'w' :
|
||||
@@ -726,6 +722,13 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
err_sys("UseSNI failed");
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINDOWS_API
|
||||
if (port == 0) {
|
||||
/* Generate random port for testing */
|
||||
port = GetRandomPort();
|
||||
}
|
||||
#endif /* USE_WINDOWS_API */
|
||||
|
||||
while (1) {
|
||||
/* allow resume option */
|
||||
if(resumeCount > 1) {
|
||||
|
||||
Reference in New Issue
Block a user