mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +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
|
||||
|
||||
if (dtlsUDP == 0) { /* don't send alert after "break" command */
|
||||
ret = wolfSSL_shutdown(ssl);
|
||||
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||
if (tcp_select(sockfd, DEFAULT_TIMEOUT_SEC) == TEST_RECV_READY) {
|
||||
ret = wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
printf("Bidirectional shutdown complete\n");
|
||||
ret = wolfSSL_shutdown(ssl);
|
||||
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||
while (tcp_select(wolfSSL_get_fd(ssl), DEFAULT_TIMEOUT_SEC) ==
|
||||
TEST_RECV_READY) {
|
||||
ret = wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
printf("Bidirectional shutdown complete\n");
|
||||
break;
|
||||
}
|
||||
if (ret != WOLFSSL_SUCCESS)
|
||||
else if (ret != WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||
printf("Bidirectional shutdown failed\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ret != WOLFSSL_SUCCESS)
|
||||
printf("Bidirectional shutdown failed\n");
|
||||
}
|
||||
#if defined(ATOMIC_USER) && !defined(WOLFSSL_AEAD_ONLY)
|
||||
if (atomicUser)
|
||||
|
@ -3356,9 +3356,20 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
|
||||
ret = SSL_shutdown(ssl);
|
||||
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||
ret = SSL_shutdown(ssl); /* bidirectional shutdown */
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
printf("Bidirectional shutdown complete\n");
|
||||
while (tcp_select(wolfSSL_get_fd(ssl), DEFAULT_TIMEOUT_SEC) ==
|
||||
TEST_RECV_READY) {
|
||||
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 */
|
||||
|
Reference in New Issue
Block a user