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

Fix bugs in receiveSingleIteration and optimize sendMessageVector #218

Merged
merged 9 commits into from
Sep 21, 2022
Merged

Fix bugs in receiveSingleIteration and optimize sendMessageVector #218

merged 9 commits into from
Sep 21, 2022

Conversation

AniruddhaKanhere
Copy link
Member

This PR fixes a bug in receiveSingleIteration function which caused existing data not to be processed till new data was received on the transport interface. The bug is fixed by adding an additional check in the MQTTNoDataAvailable case as below:

-   else if( recvBytes == 0 )
+   else if( ( recvBytes == 0 ) && ( pContext->index == 0 ) )
    {
        /* No more bytes available since the last read and neither is anything in
         * the buffer. */
        status = MQTTNoDataAvailable;
    }

This PR also fixes the issue in the send function where sending with 0 timeout failed as the time was checked before an attempt to send. The fix moves the time check after the send call thus allowing at least one send even with 0 timeout set.

paulbartell
paulbartell previously approved these changes Sep 21, 2022
archigup
archigup previously approved these changes Sep 21, 2022
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

Successfully merging this pull request may close these issues.

3 participants