Skip to content

Commit 690630b

Browse files
Lenart12deadprogram
authored andcommitted
linux: close scan in progress channel on adapter power off
1 parent 97eb13b commit 690630b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

gap_linux.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ func (a *Adapter) Scan(callback func(*Adapter, ScanResult)) error {
240240
if k == "Powered" && !v.Value().(bool) {
241241
// adapter is powered off, stop the scan
242242
close(cancelChan)
243+
close(a.scanCancelChan)
244+
a.scanCancelChan = nil
243245
return errAdaptorNotPowered
244246
}
245247
}

0 commit comments

Comments
 (0)