1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-22 03:03:18 +00:00

1. Fixed to address changes with OpenSSL/1.1.1c

2. ToDo: Still need to update WebRTC and Pending Writes
This commit is contained in:
Bryan Roe
2019-06-19 15:29:56 -07:00
parent f8eca4008a
commit 13ad575bb5

View File

@@ -598,8 +598,7 @@ ILibAsyncSocket_SendStatus ILibAsyncSocket_SendTo_MultiWrite(ILibAsyncSocket_Soc
else if (bytesSent == module->writeBioBuffer->length) else if (bytesSent == module->writeBioBuffer->length)
{ {
retVal = ILibAsyncSocket_ALL_DATA_SENT; retVal = ILibAsyncSocket_ALL_DATA_SENT;
module->writeBioBuffer->length = 0; BIO_reset(module->writeBio);
module->writeBioBuffer->data += bytesSent;
module->TotalBytesSent += bytesSent; module->TotalBytesSent += bytesSent;
module->PendingBytesToSend = (unsigned int)(module->writeBioBuffer->length); module->PendingBytesToSend = (unsigned int)(module->writeBioBuffer->length);
} }
@@ -1077,8 +1076,7 @@ ILibAsyncSocket_SendStatus ILibAsyncSocket_ProcessEncryptedBuffer(ILibAsyncSocke
else if (j == (int)(Reader->writeBioBuffer->length)) else if (j == (int)(Reader->writeBioBuffer->length))
{ {
// All Data was sent // All Data was sent
Reader->writeBioBuffer->length = 0; BIO_reset(Reader->writeBio);
Reader->writeBioBuffer->data += j;
retVal = ILibAsyncSocket_ALL_DATA_SENT; retVal = ILibAsyncSocket_ALL_DATA_SENT;
} }
} }
@@ -1872,8 +1870,7 @@ void ILibAsyncSocket_PostSelect(void* socketModule, int slct, fd_set *readset, f
else if(bytesSent == module->writeBioBuffer->length) else if(bytesSent == module->writeBioBuffer->length)
{ {
// All data was sent // All data was sent
module->writeBioBuffer->length = 0; BIO_reset(module->writeBio);
module->writeBioBuffer->data += bytesSent;
module->TotalBytesSent += bytesSent; module->TotalBytesSent += bytesSent;
module->PendingBytesToSend = (unsigned int)(module->writeBioBuffer->length); module->PendingBytesToSend = (unsigned int)(module->writeBioBuffer->length);
@@ -2115,12 +2112,13 @@ SSL* ILibAsyncSocket_SetSSLContextEx(ILibAsyncSocket_SocketModule socketModule,
module->TLSHandshakeCompleted = 0; module->TLSHandshakeCompleted = 0;
module->readBio = BIO_new_mem_buf(module->readBioBuffer_mem, (int)sizeof(module->readBioBuffer_mem)); module->readBio = BIO_new_mem_buf(module->readBioBuffer_mem, (int)sizeof(module->readBioBuffer_mem));
module->writeBio = BIO_new(BIO_s_mem()); module->writeBio = BIO_new(BIO_s_mem());
BIO_get_mem_ptr(module->readBio, &(module->readBioBuffer));
BIO_get_mem_ptr(module->writeBio, &(module->writeBioBuffer));
BIO_set_mem_eof_return(module->readBio, -1); BIO_set_mem_eof_return(module->readBio, -1);
BIO_set_mem_eof_return(module->writeBio, -1); BIO_set_mem_eof_return(module->writeBio, -1);
module->readBioBuffer->length = 0;
SSL_set_bio(module->ssl, module->readBio, module->writeBio); SSL_set_bio(module->ssl, module->readBio, module->writeBio);
BIO_get_mem_ptr(module->readBio, &(module->readBioBuffer));
BIO_get_mem_ptr(module->writeBio, &(module->writeBioBuffer));
module->readBioBuffer->length = 0;
if (server == ILibAsyncSocket_TLS_Mode_Client) if (server == ILibAsyncSocket_TLS_Mode_Client)
{ {
if (hostName != NULL) { SSL_set_tlsext_host_name(module->ssl, hostName); } if (hostName != NULL) { SSL_set_tlsext_host_name(module->ssl, hostName); }