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

Updated AsyncSocket_MultiWrite and WebRTC for OpenSSL/1.1.1c

This commit is contained in:
Bryan Roe
2019-06-20 14:14:50 -07:00
parent 6de8178723
commit eb297dbfe8
2 changed files with 11 additions and 9 deletions

View File

@@ -583,15 +583,20 @@ ILibAsyncSocket_SendStatus ILibAsyncSocket_SendTo_MultiWrite(ILibAsyncSocket_Soc
#endif
{
// Still Pending Data to be sent
data = (ILibAsyncSocket_SendData*)ILibMemory_Allocate(sizeof(ILibAsyncSocket_SendData), 0, NULL, NULL);
data = (ILibAsyncSocket_SendData*)ILibMemory_Allocate(sizeof(ILibAsyncSocket_SendData), bytesSent < 0 ? 0 : (int)(module->writeBioBuffer->length) - bytesSent, NULL, NULL);
data->UserFree = ILibAsyncSocket_MemoryOwnership_BIO;
data->bytesSent = 0;
module->PendingSend_Head = module->PendingSend_Tail = data;
if (bytesSent > 0)
{
module->writeBioBuffer->data += bytesSent;
module->writeBioBuffer->length -= bytesSent;
// Some data was sent, so we need to pull the data and buffer it
module->PendingSend_Head->buffer = ILibMemory_GetExtraMemory(data, sizeof(ILibAsyncSocket_SendData));
module->PendingSend_Head->bufferSize = (int)(module->writeBioBuffer->length) - bytesSent;
memcpy_s(module->PendingSend_Head->buffer, module->PendingSend_Head->bufferSize, module->writeBioBuffer->data + bytesSent, module->PendingSend_Head->bufferSize);
module->TotalBytesSent += bytesSent;
module->PendingBytesToSend = (unsigned int)(module->writeBioBuffer->length);
module->PendingBytesToSend = (unsigned int)(module->PendingSend_Head->bufferSize);
BIO_reset(module->writeBio);
}
retVal = ILibAsyncSocket_NOT_ALL_DATA_SENT_YET;
}

View File

@@ -3098,8 +3098,7 @@ ILibTransport_DoneState ILibStun_SendDtls(struct ILibStun_Module *obj, int sessi
{
r = (ILibTransport_DoneState)ILibAsyncUDPSocket_SendTo(((struct ILibStun_Module*)obj)->UDP, (struct sockaddr*)obj->dTlsSessions[session]->remoteInterface, obj->dTlsSessions[session]->writeBIOBuffer->data, obj->dTlsSessions[session]->writeBIOBuffer->length, ILibAsyncSocket_MemoryOwnership_USER);
}
obj->dTlsSessions[session]->writeBIOBuffer->data += (obj->dTlsSessions[session]->writeBIOBuffer->length);
obj->dTlsSessions[session]->writeBIOBuffer->length = 0;
BIO_reset(obj->dTlsSessions[session]->writeBIO);
}
return r;
}
@@ -6124,9 +6123,7 @@ void ILibStun_OnUDP(ILibAsyncUDPSocket_SocketModule socketModule, char* buffer,
ILibAsyncUDPSocket_SendTo(((struct ILibStun_Module*)obj)->UDP, (struct sockaddr*)remoteInterface, obj->dTlsSessions[existingSession]->writeBIOBuffer->data, obj->dTlsSessions[existingSession]->writeBIOBuffer->length, ILibAsyncSocket_MemoryOwnership_USER);
}
if(obj->dTlsSessions[existingSession]->state == 4) {ILibWebRTC_DTLS_HandshakeDetect(obj, "S ", obj->dTlsSessions[existingSession]->writeBIOBuffer->data, 0, (int)obj->dTlsSessions[existingSession]->writeBIOBuffer->length);}
obj->dTlsSessions[existingSession]->writeBIOBuffer->data += (obj->dTlsSessions[existingSession]->writeBIOBuffer->length);
obj->dTlsSessions[existingSession]->writeBIOBuffer->length = 0;
BIO_reset(obj->dTlsSessions[existingSession]->writeBIO);
}
sem_post(&(obj->dTlsSessions[existingSession]->Lock));
}