mirror of https://github.com/ARMmbed/mbed-os.git
Nanostack: release connect_semaphore only when it is pending
Only release if the current _connect_status is CONNECTING. If the semaphore is released many times for each connect, then the next connect will not wait(), as it will be able to decrement the semaphore imediatelly.pull/10532/head
parent
e7cbad4558
commit
d47f18a130
|
@ -120,8 +120,9 @@ nsapi_error_t MeshInterfaceNanostack::initialize(NanostackRfPhy *phy)
|
|||
void Nanostack::Interface::network_handler(mesh_connection_status_t status)
|
||||
{
|
||||
if (_blocking) {
|
||||
if (status == MESH_CONNECTED || status == MESH_CONNECTED_LOCAL ||
|
||||
status == MESH_CONNECTED_GLOBAL) {
|
||||
if (_connect_status == NSAPI_STATUS_CONNECTING
|
||||
&& (status == MESH_CONNECTED || status == MESH_CONNECTED_LOCAL
|
||||
|| status == MESH_CONNECTED_GLOBAL)) {
|
||||
connect_semaphore.release();
|
||||
} else if (status == MESH_DISCONNECTED) {
|
||||
disconnect_semaphore.release();
|
||||
|
|
Loading…
Reference in New Issue