Fix bug where Connect blocked forever after 10 seconds
This commit is contained in:
parent
d228b6cf60
commit
47293f04bc
@ -168,12 +168,11 @@ func pair(timeout time.Duration) (*Device, error) {
|
||||
// Create new device
|
||||
out := &Device{}
|
||||
// Start bluetooth discovery
|
||||
discovery, cancelDiscover, err := bt.Discover(defaultAdapter, &adapter.DiscoveryFilter{Transport: "le"})
|
||||
// Ignore the cancel function as it blocks forever
|
||||
discovery, _, err := bt.Discover(defaultAdapter, &adapter.DiscoveryFilter{Transport: "le"})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Cancel discovery at end of function
|
||||
defer cancelDiscover()
|
||||
discoveryLoop:
|
||||
for {
|
||||
select {
|
||||
|
Reference in New Issue
Block a user