Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is called by
zsock_close()so wondering why we would need to call it again here. What kind of socket is this, a TLS one?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.
Also, I don't think we should call socket specific API here in the generic code.
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.
This is a TCP socket.
sock_obj_core_dealloc is indeed called by zsock_close, however with POSIX_API enabled we never reach zsock_close, and comparing the two functions the only real difference is that zsock_close actually calls sock_obj_core_dealloc, which properly closes the socket.
zsock_close does the following: https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/net/lib/sockets/sockets.c#L137
Uh oh!
There was an error while loading. Please reload this page.
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.
Something is now wrong if socket close is not called. Either this function should not be called at all but
zsock_close()should, or the system should be configured so that thefdtable[fd].vtable->close(fdtable[fd].obj);would call the network socket close. In all cases this function should not do anything socket specific as this is a generic function that just dispatches the call to correct subsystem.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.
Yeah, I would agree - the vtable call should deallocate any fs-specific object associated with the generic fd.