ninafw: fix connection timeout
The break statement didn't actually break the for loop, it just exited the switch case. Discovered because VS Code flagged the code after the loop as dead code.
This commit is contained in:
parent
190c4be423
commit
eb30760e41
1 changed files with 2 additions and 3 deletions
|
@ -155,8 +155,7 @@ func (a *Adapter) Connect(address Address, params ConnectionParams) (*Device, er
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch {
|
if a.hci.connectData.connected {
|
||||||
case a.hci.connectData.connected:
|
|
||||||
defer a.hci.clearConnectData()
|
defer a.hci.clearConnectData()
|
||||||
|
|
||||||
random := false
|
random := false
|
||||||
|
@ -178,7 +177,7 @@ func (a *Adapter) Connect(address Address, params ConnectionParams) (*Device, er
|
||||||
|
|
||||||
return d, nil
|
return d, nil
|
||||||
|
|
||||||
default:
|
} else {
|
||||||
// check for timeout
|
// check for timeout
|
||||||
if (time.Now().UnixNano()-start)/int64(time.Second) > 5 {
|
if (time.Now().UnixNano()-start)/int64(time.Second) > 5 {
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue