-
Notifications
You must be signed in to change notification settings - Fork 3k
nsapi: Change initial state of sockets to allow events #3619
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
Conversation
Note, the registered callback is still disabled by a call to socket_attach. This will avoid being called after the socket is closed unless close is called from the attached callback, which is in irq context. As pointed out by kjbracey-arm, the previous behaviour was broken for sockets that started out listening.
/morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
@kjbracey-arm Can you pls review? |
Bump |
Thank you for the heads-up! I'm not happy with the direction the Socket API is taking, but that's a discussion for a different place. |
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.
@marcuschangarm I tested this PR with the integration test in our update-client-source-manager, which was the reason for the original PR (the one that was reversed here). It seems to work fine on my side.
@bogdanm I'm pretty sure it will break our error recovery code |
If this affects behaviour of any code, the code is already broken, as it's not conforming to the defined netsocket API, which clearly states that spurious or excess callbacks may occur. (This is because we're merely a thin abstraction layer, not a network implementation, and don't have the necessary access to the internals of the actual network stack to know what's really going on). If this change affects code, that code is also likely to fail when connected to different network stacks. In this case, we're re-enabling this to stop NSAPI blocking required (not spurious!) callbacks for newly-created sockets. It's possible that might also let through some more spurious callbacks from the underlying stack, but correctly-written code won't care. |
As pointed out by @kjbracey-arm, the previous behaviour was broken for sockets that started out listening.
Note, the registered callback is still disabled by a call to socket_attach. This will avoid being called after the socket is closed unless close is called from the attached callback, which is in irq context.
This effectively reverts #3374, which contains a discussion on the expected behaviour.
This may also help standardize some of the change in behaviour that came out of #3457.
cc @kjbracey-arm, @0xc0170