add option for bidirectional shutdown

This commit is contained in:
lchristina26
2015-01-30 08:41:34 -07:00
parent fe26b86207
commit db5a95b370
4 changed files with 61 additions and 10 deletions

View File

@@ -936,6 +936,17 @@ int wolfSSL_shutdown(WOLFSSL* ssl)
return SSL_FATAL_ERROR;
}
ssl->options.sentNotify = 1; /* don't send close_notify twice */
WOLFSSL_LEAVE("SSL_shutdown()", ssl->error);
return 0;
}
/* call wolfSSL_shutdown again for bidirectional shudown */
if (ssl->options.sentNotify && !ssl->options.closeNotify) {
ssl->error = ReceiveData(ssl, 0, 0, 0);
if (ssl->error < 0) {
WOLFSSL_ERROR(ssl->error);
return SSL_FATAL_ERROR;
}
}
WOLFSSL_LEAVE("SSL_shutdown()", ssl->error);