@@ -7321,10 +7321,12 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup)
73217321 ssl->alert_history.last_tx.code = -1;
73227322 ssl->alert_history.last_tx.level = -1;
73237323
7324- #ifdef OPENSSL_EXTRA
7324+ #ifdef WOLFSSL_SESSION_ID_CTX
73257325 /* copy over application session context ID */
73267326 ssl->sessionCtxSz = ctx->sessionCtxSz;
73277327 XMEMCPY(ssl->sessionCtx, ctx->sessionCtx, ctx->sessionCtxSz);
7328+ #endif
7329+ #ifdef OPENSSL_EXTRA
73287330 ssl->cbioFlag = ctx->cbioFlag;
73297331
73307332 ssl->protoMsgCb = ctx->protoMsgCb;
@@ -10359,6 +10361,8 @@ void ShrinkInputBuffer(WOLFSSL* ssl, int forcedFree)
1035910361
1036010362int SendBuffered(WOLFSSL* ssl)
1036110363{
10364+ int retryLimit = WOLFSSL_MODE_AUTO_RETRY_ATTEMPTS;
10365+
1036210366 if (ssl->CBIOSend == NULL && !WOLFSSL_IS_QUIC(ssl)) {
1036310367 WOLFSSL_MSG("Your IO Send callback is null, please set");
1036410368 return SOCKET_ERROR_E;
@@ -10379,15 +10383,22 @@ int SendBuffered(WOLFSSL* ssl)
1037910383#endif
1038010384
1038110385 while (ssl->buffers.outputBuffer.length > 0) {
10382- int sent = ssl->CBIOSend(ssl,
10383- (char*)ssl->buffers.outputBuffer.buffer +
10384- ssl->buffers.outputBuffer.idx,
10385- (int)ssl->buffers.outputBuffer.length,
10386- ssl->IOCB_WriteCtx);
10386+ int sent = 0;
10387+ retry:
10388+ sent = ssl->CBIOSend(ssl,
10389+ (char*)ssl->buffers.outputBuffer.buffer +
10390+ ssl->buffers.outputBuffer.idx,
10391+ (int)ssl->buffers.outputBuffer.length,
10392+ ssl->IOCB_WriteCtx);
1038710393 if (sent < 0) {
1038810394 switch (sent) {
1038910395
1039010396 case WOLFSSL_CBIO_ERR_WANT_WRITE: /* would block */
10397+ if (retryLimit > 0 && ssl->ctx->autoRetry &&
10398+ !ssl->options.handShakeDone && !ssl->options.dtls) {
10399+ retryLimit--;
10400+ goto retry;
10401+ }
1039110402 return WANT_WRITE;
1039210403
1039310404 case WOLFSSL_CBIO_ERR_CONN_RST: /* connection reset */
0 commit comments