Updates from review
This commit is contained in:
parent
41d3ba0efa
commit
3f7ce61dbd
@ -762,8 +762,14 @@ static int SMTP_Shutdown(WOLFSSL* ssl, int wc_shutdown)
|
||||
printf("%s\n", tmpBuf);
|
||||
|
||||
ret = wolfSSL_shutdown(ssl);
|
||||
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE)
|
||||
wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
||||
while (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");
|
||||
}
|
||||
}
|
||||
|
||||
return WOLFSSL_SUCCESS;
|
||||
}
|
||||
@ -3046,9 +3052,11 @@ 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) {
|
||||
ret = wolfSSL_shutdown(ssl); /* bidirectional shutdown */
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
printf("Bidirectional shutdown complete\n");
|
||||
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 defined(ATOMIC_USER) && !defined(WOLFSSL_AEAD_ONLY)
|
||||
|
@ -51,6 +51,8 @@
|
||||
static int devId = INVALID_DEVID;
|
||||
#endif
|
||||
|
||||
#define DEFAULT_TIMEOUT_SEC 2
|
||||
|
||||
/* Note on using port 0: if the server uses port 0 to bind an ephemeral port
|
||||
* number and is using the ready file for scripted testing, the code in
|
||||
* test.h will write the actual port number into the ready file for use
|
||||
@ -2378,7 +2380,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
|
||||
|
||||
if (dtlsUDP == 0) {
|
||||
ret = SSL_shutdown(ssl);
|
||||
while (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||
if (wc_shutdown && ret == WOLFSSL_SHUTDOWN_NOT_DONE) {
|
||||
ret = SSL_shutdown(ssl); /* bidirectional shutdown */
|
||||
if (ret == WOLFSSL_SUCCESS)
|
||||
printf("Bidirectional shutdown complete\n");
|
||||
|
17
src/ssl.c
17
src/ssl.c
@ -2908,7 +2908,6 @@ WOLFSSL_ABI
|
||||
int wolfSSL_shutdown(WOLFSSL* ssl)
|
||||
{
|
||||
int ret = WOLFSSL_FATAL_ERROR;
|
||||
byte tmp;
|
||||
WOLFSSL_ENTER("SSL_shutdown()");
|
||||
|
||||
if (ssl == NULL)
|
||||
@ -2947,16 +2946,16 @@ int wolfSSL_shutdown(WOLFSSL* ssl)
|
||||
|
||||
/* call wolfSSL_shutdown again for bidirectional shutdown */
|
||||
if (ssl->options.sentNotify && !ssl->options.closeNotify) {
|
||||
ret = wolfSSL_read(ssl, &tmp, 1);
|
||||
if (ret < 0) {
|
||||
ret = ProcessReply(ssl);
|
||||
if (ret == ZERO_RETURN) {
|
||||
/* simulate OpenSSL behavior */
|
||||
ssl->error = WOLFSSL_ERROR_SYSCALL;
|
||||
ret = WOLFSSL_SUCCESS;
|
||||
} else if (ssl->error == WOLFSSL_ERROR_NONE) {
|
||||
ret = WOLFSSL_SHUTDOWN_NOT_DONE;
|
||||
} else {
|
||||
WOLFSSL_ERROR(ssl->error);
|
||||
ret = WOLFSSL_FATAL_ERROR;
|
||||
} else if (ssl->options.closeNotify) {
|
||||
ssl->error = WOLFSSL_ERROR_SYSCALL; /* simulate OpenSSL behavior */
|
||||
ret = WOLFSSL_SUCCESS;
|
||||
} else if ((ssl->error == WOLFSSL_ERROR_NONE) &&
|
||||
(ret > 0)) {
|
||||
ret = WOLFSSL_SHUTDOWN_NOT_DONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user