mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
SendAlert: clear output buffer to try and send the alert now
This commit is contained in:
@@ -20640,8 +20640,25 @@ int SendAlert(WOLFSSL* ssl, int severity, int type)
|
|||||||
|
|
||||||
/* check for available size */
|
/* check for available size */
|
||||||
outputSz = ALERT_SIZE + MAX_MSG_EXTRA + dtlsExtra;
|
outputSz = ALERT_SIZE + MAX_MSG_EXTRA + dtlsExtra;
|
||||||
if ((ret = CheckAvailableSize(ssl, outputSz)) != 0)
|
if ((ret = CheckAvailableSize(ssl, outputSz)) != 0) {
|
||||||
|
#ifdef WOLFSSL_DTLS
|
||||||
|
/* If CheckAvailableSize returned WANT_WRITE due to a blocking write
|
||||||
|
* then discard pending output and just send the alert. */
|
||||||
|
if (ssl->options.dtls) {
|
||||||
|
if (ret != WANT_WRITE || severity != alert_fatal)
|
||||||
return ret;
|
return ret;
|
||||||
|
ShrinkOutputBuffer(ssl);
|
||||||
|
if ((ret = CheckAvailableSize(ssl, outputSz)) != 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return ret;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Check output buffer */
|
/* Check output buffer */
|
||||||
if (ssl->buffers.outputBuffer.buffer == NULL)
|
if (ssl->buffers.outputBuffer.buffer == NULL)
|
||||||
|
Reference in New Issue
Block a user