Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3 upload bug #185

Closed
Gwanyoung-K opened this issue Oct 22, 2024 · 4 comments
Closed

s3 upload bug #185

Gwanyoung-K opened this issue Oct 22, 2024 · 4 comments

Comments

@Gwanyoung-K
Copy link

Gwanyoung-K commented Oct 22, 2024

/*-----------------------------------------------------------*/

HTTPStatus_t HTTPClient_SendHttpData( const TransportInterface_t * pTransport,
                                      HTTPClient_GetCurrentTimeFunc_t getTimestampMs,
                                      const uint8_t * pData,
                                      size_t dataLen )
{
    HTTPStatus_t returnStatus = HTTPSuccess;
    const uint8_t * pIndex = pData;
    int32_t bytesSent = 0;
    size_t bytesRemaining = dataLen;
    uint32_t lastSendTimeMs = 0U, timeSinceLastSendMs = 0U;
    uint32_t retryTimeoutMs = HTTP_SEND_RETRY_TIMEOUT_MS;

    assert( pTransport != NULL );
    assert( pTransport->send != NULL );
    assert( pData != NULL );

    /* If the timestamp function was undefined by the application, then do not
     * retry the transport send. */
    if( getTimestampMs == getZeroTimestampMs )
    {
        retryTimeoutMs = 0U;
    }

    /* Initialize the last send time to allow retries, if 0 bytes are sent on
     * the first try. */
    **_lastSendTimeMs_** = getTimestampMs();

    /* Loop until all data is sent. */
    while( ( bytesRemaining > 0UL ) && ( returnStatus != HTTPNetworkError ) )
    {
        bytesSent = pTransport->send( pTransport->pNetworkContext,

The getTimestampMs is function. But in this code it is using like valiable.
So when I try to upload s3 data, it can't upload over 30KB.
If not modify, it shows this error message [ERROR] [HTTP] [core_http_client.c:1859] Unable to send packet: Timed out in transport send.

best regards.
Gwanyoung Kim.

@aggarg
Copy link
Member

aggarg commented Oct 22, 2024

When the application calls HTTPClient_Send with pResponse->getTime set as NULL, it is set to the internal function getZeroTimestampMs here - https://github.com/FreeRTOS/coreHTTP/blob/main/source/core_http_client.c#L2284. The updated pResponse->getTime is then passed to the function you mentioned -

There is nothing wrong in the check you mentioned. Which API are you calling from your application? Area you calling HTTPClient_Send with pResponse->getTime set as NULL?

@Gwanyoung-K
Copy link
Author

Gwanyoung-K commented Oct 23, 2024

When the application calls HTTPClient_Send with pResponse->getTime set as NULL, it is set to the internal function getZeroTimestampMs here - https://github.com/FreeRTOS/coreHTTP/blob/main/source/core_http_client.c#L2284. The updated pResponse->getTime is then passed to the function you mentioned -

* https://github.com/FreeRTOS/coreHTTP/blob/main/source/core_http_client.c#L2292

* https://github.com/FreeRTOS/coreHTTP/blob/main/source/core_http_client.c#L2193

* https://github.com/FreeRTOS/coreHTTP/blob/main/source/core_http_client.c#L1978

There is nothing wrong in the check you mentioned. Which API are you calling from your application? Area you calling HTTPClient_Send with pResponse->getTime set as NULL?

Hi aggard.
Should I align custom function to the pResponse->getTime function?

@aggarg
Copy link
Member

aggarg commented Oct 23, 2024

Should I align custom function to the pResponse->getTime function?

Yes, if you want to retry network send/receive operations, you need to provide a custom getTime function which returns time in milliseconds.

@Gwanyoung-K
Copy link
Author

Should I align custom function to the pResponse->getTime function?

Yes, if you want to retry network send/receive operations, you need to provide a custom getTime function which returns time in milliseconds.

Now it works well.
Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants