Group Early Data message with ClientHello for faster delivery

This commit is contained in:
Sean Parkinson
2018-08-31 08:41:04 +10:00
parent 31e37ea5df
commit d089a4651a
2 changed files with 8 additions and 2 deletions

View File

@@ -14739,6 +14739,7 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
sendSz,
ret,
dtlsExtra = 0;
int groupMsgs = 0;
if (ssl->error == WANT_WRITE
#ifdef WOLFSSL_ASYNC_CRYPT
@@ -14763,6 +14764,7 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
WOLFSSL_MSG("handshake complete, trying to send early data");
return BUILD_MSG_ERROR;
}
groupMsgs = 1;
}
else
#endif
@@ -14781,7 +14783,7 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
}
/* last time system socket output buffer was full, try again to send */
if (ssl->buffers.outputBuffer.length > 0) {
if (!groupMsgs && ssl->buffers.outputBuffer.length > 0) {
WOLFSSL_MSG("output buffer was full, trying to send again");
if ( (ssl->error = SendBuffered(ssl)) < 0) {
WOLFSSL_ERROR(ssl->error);

View File

@@ -2670,7 +2670,11 @@ int SendTls13ClientHello(WOLFSSL* ssl)
ssl->buffers.outputBuffer.length += sendSz;
ret = SendBuffered(ssl);
#ifdef WOLFSSL_EARLY_DATA
if (ssl->earlyData == no_early_data)
#endif
ret = SendBuffered(ssl);
WOLFSSL_LEAVE("SendTls13ClientHello", ret);
WOLFSSL_END(WC_FUNC_CLIENT_HELLO_SEND);