Skip to content

Release candidate for mbed-os-5.3.0-rc3 #3394

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 2 commits into from
Dec 8, 2016
Merged

Conversation

adbridge
Copy link
Contributor

@adbridge adbridge commented Dec 8, 2016

No description provided.

0xc0170 and others added 2 commits December 8, 2016 10:48
Fixes mbed-cli#402 bug. -g flag was changed to g3, thus this caused
a regression in producing TARGET_DEBUG for GCC_ARM.
It's currently possible to generate a socket event when a non-blocking socket is closed:

1. _pending is set to 0 in https://github.com/ARMmbed/mbed-os/blob/master/features/netsocket/TCPSocket.cpp#L22
   when the socket is created.
2. close() calls event() in https://github.com/ARMmbed/mbed-os/blob/master/features/netsocket/Socket.cpp#L66
3. event() increments _pending, and since _pending is 1 it will call _callback() in https://github.com/ARMmbed/mbed-os/blob/master/features/netsocket/TCPSocket.cpp#L167

However, if send() (for example) is called, this can happen:

- send() is called and sets _pending to 0.
- when the data is sent, event() is called, which sets _pending to 1 and calls _callback().
- if close() is called at this point, there won't be an event generated for close() anymore,
  since _pending will be set to 2.

Same thing for recv. Also, same thing for TCPServer and UDPSocket.

This PR changes the initial value of _pending to 1 instead of 0, so that
events are never generated for close().
@adbridge
Copy link
Contributor Author

adbridge commented Dec 8, 2016

/morph test

@mbed-bot
Copy link

mbed-bot commented Dec 8, 2016

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 1223

All builds and test passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 8, 2016

uvisor CI looks good as well

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.

3 participants