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
|
// Create new device
|
||||||
out := &Device{}
|
out := &Device{}
|
||||||
// Start bluetooth discovery
|
// 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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// Cancel discovery at end of function
|
|
||||||
defer cancelDiscover()
|
|
||||||
discoveryLoop:
|
discoveryLoop:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
Reference in New Issue
Block a user