-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sock: tcp: fix sock_tcp_read() example #16743
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the example is currently conaistent with the API doc. According to the current API doc, there is no way to detect when a TCP connection is closed. That obviously is a design flaw in need to be fixed. I trust that the implementation already has been fixed, but fixing the was forgotten. Care to add a commit to fiz this? Also, the @retval
Doxygen command would make sense for documenting the individual magic return constants.
TBH I'm a bit surprised it does not return |
Maybe it is worth to discuss the correct behaviour first. But note: Both POSIX |
-ECONNABORTED is used as an error condition. Closing a connection normally is not an error. TCP assumes that a connection can be closed from any participating peer at any time regardless of what the peer is currently doing. Think of recv for example: |
sock_tcp_read() will return 0 if the connection was closed, we need to check for this.
ea236b4
to
c3849ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and @brummer-simon is fine with the change. ACK.
Contribution description
sock_tcp_read()
will return 0 if the connection was closed, we need to check for this.Testing procedure
Issues/PRs references
#16494 (comment)