mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
examples: allow bidirectional shutdown in UDP
This commit allows the examples to perform a bidirectional shutdown also when using UDP. It is useful to test DTLS retransmission. Signed-off-by: Marco Oliverio <marco@wolfssl.com>
This commit is contained in:
committed by
Marco Oliverio
parent
d133fa6143
commit
257c55a311
@ -4059,17 +4059,22 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dtlsUDP == 0) { /* don't send alert after "break" command */
|
ret = wolfSSL_shutdown(ssl);
|
||||||
ret = wolfSSL_shutdown(ssl);
|
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||||
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
while (tcp_select(wolfSSL_get_fd(ssl), DEFAULT_TIMEOUT_SEC) ==
|
||||||
if (tcp_select(sockfd, DEFAULT_TIMEOUT_SEC) == TEST_RECV_READY) {
|
TEST_RECV_READY) {
|
||||||
ret = wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
ret = wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
||||||
if (ret == WOLFSSL_SUCCESS)
|
if (ret == WOLFSSL_SUCCESS) {
|
||||||
printf("Bidirectional shutdown complete\n");
|
printf("Bidirectional shutdown complete\n");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (ret != WOLFSSL_SUCCESS)
|
else if (ret != WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||||
printf("Bidirectional shutdown failed\n");
|
printf("Bidirectional shutdown failed\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (ret != WOLFSSL_SUCCESS)
|
||||||
|
printf("Bidirectional shutdown failed\n");
|
||||||
}
|
}
|
||||||
#if defined(ATOMIC_USER) && !defined(WOLFSSL_AEAD_ONLY)
|
#if defined(ATOMIC_USER) && !defined(WOLFSSL_AEAD_ONLY)
|
||||||
if (atomicUser)
|
if (atomicUser)
|
||||||
|
@ -3356,9 +3356,20 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
|||||||
|
|
||||||
ret = SSL_shutdown(ssl);
|
ret = SSL_shutdown(ssl);
|
||||||
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||||
ret = SSL_shutdown(ssl); /* bidirectional shutdown */
|
while (tcp_select(wolfSSL_get_fd(ssl), DEFAULT_TIMEOUT_SEC) ==
|
||||||
if (ret == WOLFSSL_SUCCESS)
|
TEST_RECV_READY) {
|
||||||
printf("Bidirectional shutdown complete\n");
|
ret = wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
||||||
|
if (ret == WOLFSSL_SUCCESS) {
|
||||||
|
printf("Bidirectional shutdown complete\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (ret != WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||||
|
printf("Bidirectional shutdown failed\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ret != WOLFSSL_SUCCESS)
|
||||||
|
printf("Bidirectional shutdown failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* display collected statistics */
|
/* display collected statistics */
|
||||||
|
Reference in New Issue
Block a user