Skip to content

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

Merged
merged 1 commit into from
Feb 7, 2017

Conversation

geky
Copy link
Contributor

@geky geky commented Jan 20, 2017

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

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.
@bridadan
Copy link
Contributor

/morph test-nightly

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 1436

All builds and test passed!

@geky geky changed the title nsapi: Changed initial state of sockets to allow events nsapi: Change initial state of sockets to allow events Jan 20, 2017
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 25, 2017

@kjbracey-arm Can you pls review?

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 30, 2017

Bump

@marcuschangarm
Copy link
Contributor

@sg-

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.

Copy link
Contributor

@bogdanm bogdanm left a 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.

@marcuschangarm
Copy link
Contributor

@bogdanm I'm pretty sure it will break our error recovery code

@kjbracey
Copy link
Contributor

kjbracey commented Feb 7, 2017

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.

@sg- sg- merged commit 2b6fed7 into ARMmbed:master Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants