Merge pull request #10462 from michalpasztamobica/nanostack_semaphore_release_connecting

Nanostack: release connect_semaphore only when it is pending
pull/10503/head
Anna Bridge 2019-04-26 13:37:53 +01:00 committed by GitHub
commit 1647282de9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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();