fixed reuse of mbedtls
This commit is contained in:
parent
7afe6bb195
commit
3c0232c7de
|
@ -78,21 +78,22 @@ https_client_ret_t https_clientInitialize()
|
||||||
|
|
||||||
i32RetHTTPClient = https_clientInitEmbedTLS();
|
i32RetHTTPClient = https_clientInitEmbedTLS();
|
||||||
|
|
||||||
if(i32RetHTTPClient == HTTPS_CLIENT_OK)
|
/*
|
||||||
{
|
if(i32RetHTTPClient == HTTPS_CLIENT_OK)
|
||||||
i32RetHTTPClient = https_clientConnectToServer();
|
{
|
||||||
}
|
i32RetHTTPClient = https_clientConnectToServer();
|
||||||
|
}
|
||||||
|
|
||||||
if(i32RetHTTPClient == HTTPS_CLIENT_OK)
|
if(i32RetHTTPClient == HTTPS_CLIENT_OK)
|
||||||
{
|
{
|
||||||
i32RetHTTPClient = https_clientValidateServer();
|
i32RetHTTPClient = https_clientValidateServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i32RetHTTPClient == HTTPS_CLIENT_OK)
|
|
||||||
{
|
|
||||||
i32RetHTTPClient = https_clientSendRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(i32RetHTTPClient == HTTPS_CLIENT_OK)
|
||||||
|
{
|
||||||
|
i32RetHTTPClient = https_clientSendRequest();
|
||||||
|
}
|
||||||
|
*/
|
||||||
switch (i32RetHTTPClient)
|
switch (i32RetHTTPClient)
|
||||||
{
|
{
|
||||||
case HTTPS_CLIENT_ERROR_INIT_EMBEDTLS:
|
case HTTPS_CLIENT_ERROR_INIT_EMBEDTLS:
|
||||||
|
@ -161,11 +162,11 @@ https_client_ret_t https_clientRetrieveData(unsigned char* pu8Data, uint32_t* pu
|
||||||
bRetriveData = false;
|
bRetriveData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i32RetRetrieveData == MBEDTLS_ERR_SSL_TIMEOUT ){
|
if(i32RetRetrieveData == MBEDTLS_ERR_SSL_TIMEOUT ) {
|
||||||
printf("timeout\n");
|
printf("timeout\n");
|
||||||
bRetriveData = false;
|
bRetriveData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(i32RetRetrieveData == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)
|
if(i32RetRetrieveData == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)
|
||||||
|
@ -359,37 +360,41 @@ https_client_ret_t https_clientSendRequest()
|
||||||
static void https_get_task(void *pvParameters)
|
static void https_get_task(void *pvParameters)
|
||||||
{
|
{
|
||||||
|
|
||||||
https_clientInitialize();
|
|
||||||
|
|
||||||
uint32_t u32BufferLenght = 1024U;
|
uint32_t u32BufferLenght = 1024U;
|
||||||
unsigned char buffer[1024U];
|
unsigned char buffer[1024U];
|
||||||
uint32_t u32BytesRead = 0;
|
uint32_t u32BytesRead = 0;
|
||||||
uint32_t u32readCount = 0U;
|
uint32_t u32readCount = 0U;
|
||||||
|
|
||||||
do {
|
uint32_t loops = 0;
|
||||||
|
|
||||||
https_clientRetrieveData(buffer, &u32BufferLenght, &u32BytesRead);
|
https_clientInitialize();
|
||||||
printf("read: %i\n", u32BytesRead);
|
|
||||||
u32readCount++;
|
|
||||||
} while(u32BytesRead > 0);
|
|
||||||
printf("\n END %i\n", u32readCount);
|
|
||||||
https_clientDeinitialize();
|
|
||||||
/*
|
|
||||||
u32BytesRead = 0;
|
|
||||||
u32readCount = 0U;
|
|
||||||
|
|
||||||
do {
|
while(1)
|
||||||
|
{
|
||||||
|
u32BytesRead = 0;
|
||||||
|
u32readCount = 0U;
|
||||||
|
|
||||||
https_clientRetrieveData(buffer, &u32BufferLenght, &u32BytesRead);
|
printf("\n START:%i \n", loops);
|
||||||
printf("read: %i\n", u32BytesRead);
|
|
||||||
u32readCount++;
|
|
||||||
} while(u32BytesRead > 0);
|
|
||||||
|
|
||||||
printf("\n END %i\n", u32readCount);
|
https_clientConnectToServer();
|
||||||
https_clientDeinitialize();
|
https_clientValidateServer();
|
||||||
|
https_clientSendRequest();
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
|
https_clientRetrieveData(buffer, &u32BufferLenght, &u32BytesRead);
|
||||||
|
printf("read: %i\n", u32BytesRead);
|
||||||
|
u32readCount++;
|
||||||
|
} while(u32BytesRead > 0);
|
||||||
|
printf("\n END:%i - %i\n", loops, u32readCount);
|
||||||
|
|
||||||
|
https_clientDeinitialize();
|
||||||
|
|
||||||
|
vTaskDelay( 500/portTICK_PERIOD_MS);
|
||||||
|
|
||||||
|
loops++;
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
vTaskDelay( 500/portTICK_PERIOD_MS);
|
vTaskDelay( 500/portTICK_PERIOD_MS);
|
||||||
|
|
Loading…
Reference in New Issue