Only try shutdown once in example

This commit is contained in:
Eric Blankenhorn 2020-04-01 17:48:17 -05:00
parent 3f7ce61dbd
commit b1ec15de3e
1 changed files with 6 additions and 2 deletions

View File

@ -762,13 +762,15 @@ static int SMTP_Shutdown(WOLFSSL* ssl, int wc_shutdown)
printf("%s\n", tmpBuf);
ret = wolfSSL_shutdown(ssl);
while (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
if (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");
}
if (ret != WOLFSSL_SUCCESS)
printf("Bidirectional shutdown failed\n");
}
return WOLFSSL_SUCCESS;
@ -3051,12 +3053,14 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
if (dtlsUDP == 0) { /* don't send alert after "break" command */
ret = wolfSSL_shutdown(ssl);
while (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
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");
}
if (ret != WOLFSSL_SUCCESS)
printf("Bidirectional shutdown failed\n");
}
}
#if defined(ATOMIC_USER) && !defined(WOLFSSL_AEAD_ONLY)