forked from Elara6331/infinitime
Fix bug where Connect blocked forever after 10 seconds
This commit is contained in:
parent
8f4bb3e226
commit
613a7cb044
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user