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:
Ayke van Laethem 2024-01-05 16:11:57 +01:00 committed by Ron Evans
parent 190c4be423
commit eb30760e41

View file

@ -155,8 +155,7 @@ func (a *Adapter) Connect(address Address, params ConnectionParams) (*Device, er
return nil, err
}
switch {
case a.hci.connectData.connected:
if a.hci.connectData.connected {
defer a.hci.clearConnectData()
random := false
@ -178,7 +177,7 @@ func (a *Adapter) Connect(address Address, params ConnectionParams) (*Device, er
return d, nil
default:
} else {
// check for timeout
if (time.Now().UnixNano()-start)/int64(time.Second) > 5 {
break