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

Update API documentation of transport send/recv functions #136

Merged
merged 5 commits into from
Dec 10, 2020

Conversation

aggarw13
Copy link
Contributor

@aggarw13 aggarw13 commented Dec 9, 2020

Update API of the transport interface functions for the following:

  • Transport recv() should NOT block when requested to read a single byte. It MAY block for the underlying socket timeout when requested to read n > 1 bytes.
  • Transport send() should NOT return an error when the send fails because of a full TX buffer of the underlying network stack, so that the calling library can retry the send operation.

update lexicon for spell check

more spelling fixes
sarenameas
sarenameas previously approved these changes Dec 10, 2020
dan4thewin
dan4thewin previously approved these changes Dec 10, 2020
* MY_SOCKET_TIMEOUT );
* if( bytesReceived < 0 )
* {
* // Handle socket error.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here if bytesReceived contains an error code that just means the TCP read timed (or would block) then that is not an error so bytesReceived needs to be translated into whatever the calling function will interpret as "try again" - which for our code is zero, but if this function is calling the TCP read function and passing a value back to the TLS stack then zero may also be interpreted as an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have updated the pseudo code block to add a check for a retriable error.

* // so that caller can retry operation.
* if( bytesSent == TCP_BUFFER_FULL )
* {
* bytesSent = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment as per the receive - when the error is not really an error, rather just a full buffer, the error has to be translated into whatever the calling function interprets as meaning 'try again' until you time out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the zero return value represents that the operation can be re-tried.

@aggarw13 aggarw13 dismissed stale reviews from dan4thewin and sarenameas via a58fe48 December 10, 2020 03:18
@aggarw13 aggarw13 merged commit c7a2c89 into FreeRTOS:main Dec 10, 2020
@aggarw13 aggarw13 deleted the doc/update-transport-recv branch December 10, 2020 06:25
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.

4 participants