Skip to content

Commit eb30760

Browse files
aykevldeadprogram
authored andcommitted
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.
1 parent 190c4be commit eb30760

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

gap_ninafw.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ func (a *Adapter) Connect(address Address, params ConnectionParams) (*Device, er
155155
return nil, err
156156
}
157157

158-
switch {
159-
case a.hci.connectData.connected:
158+
if a.hci.connectData.connected {
160159
defer a.hci.clearConnectData()
161160

162161
random := false
@@ -178,7 +177,7 @@ func (a *Adapter) Connect(address Address, params ConnectionParams) (*Device, er
178177

179178
return d, nil
180179

181-
default:
180+
} else {
182181
// check for timeout
183182
if (time.Now().UnixNano()-start)/int64(time.Second) > 5 {
184183
break

0 commit comments

Comments
 (0)