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(). |
||
---|---|---|
.github | ||
TESTS | ||
cmsis | ||
docs | ||
drivers | ||
events | ||
features | ||
hal | ||
platform | ||
rtos | ||
targets | ||
tools | ||
.gitattributes | ||
.gitignore | ||
.pylintrc | ||
.travis.yml | ||
CONTRIBUTING.md | ||
DOXYGEN_FRONTPAGE.md | ||
Jenkinsfile | ||
LICENSE | ||
README.md | ||
mbed.h | ||
requirements.txt |
README.md
ARM mbed OS
mbed OS is an open-source embedded operating system designed specifically for the "things" in the Internet of Things (IoT). It includes all the features you need to develop a connected product based on an ARM Cortex-M microcontroller.
mbed OS accelerates the process of creating a connected product by providing a platform operating system that includes robust security foundations, standards based communication capabilities, built-in cloud management services, and drivers for sensors, I/O devices and connectivity. mbed OS is built as a modular, configurable software stack so that you can readily customize it to the device you're developing for, and reduce memory requirements by excluding unnecessary software components.
Current release
Our current release series is mbed OS 5.2:
Getting Started for Developers
We have a getting started guide for developers using mbed OS in applications:
Getting Started for Contributors
We have a getting started guide for contributors working on mbed OS:
- Have a look in the docs directory