Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 91ba3b5

Browse files
fix(zigbee): Add lock in scanNetworks to avoid race condition
1 parent 5611368 commit 91ba3b5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎libraries/Zigbee/src/ZigbeeCore.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,14 @@ void ZigbeeCore::scanNetworks(u_int32_t channel_mask, u_int8_t scan_duration) {
515515
log_e("Zigbee stack is not started, cannot scan networks");
516516
return;
517517
}
518+
if (_scan_status == ZB_SCAN_RUNNING) {
519+
log_w("Scan already in progress, ignoring new scan request");
520+
return;
521+
}
518522
log_v("Scanning Zigbee networks");
523+
esp_zb_lock_acquire(portMAX_DELAY);
519524
esp_zb_zdo_active_scan_request(channel_mask, scan_duration, scanCompleteCallback);
525+
esp_zb_lock_release();
520526
_scan_status = ZB_SCAN_RUNNING;
521527
}
522528

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /