[fix] (Windows;performance) Ineffective break statement. Did you mean to break out of the outer loop?

This commit is contained in:
Alexandr Stelnykovych 2024-04-12 16:38:49 +03:00
parent 1ec421603f
commit 6251111cdf

View file

@ -214,7 +214,7 @@ func (ipHelper *IPHelper) getTable(ipVersion, protocol uint8) (connections []*so
maxTries := 5 maxTries := 5
usedBufSize := lbf.getBufSize() usedBufSize := lbf.getBufSize()
var buf []byte var buf []byte
triesLoop:
for i := 1; i <= maxTries; i++ { for i := 1; i <= maxTries; i++ {
bufSizeParam := usedBufSize bufSizeParam := usedBufSize
buf = make([]byte, bufSizeParam) buf = make([]byte, bufSizeParam)
@ -256,7 +256,7 @@ func (ipHelper *IPHelper) getTable(ipVersion, protocol uint8) (connections []*so
return nil, nil, fmt.Errorf("invalid parameter: [NT 0x%X] %s", r1, err) return nil, nil, fmt.Errorf("invalid parameter: [NT 0x%X] %s", r1, err)
case windows.NO_ERROR: case windows.NO_ERROR:
// success // success
break break triesLoop
default: default:
return nil, nil, fmt.Errorf("unexpected error: [NT 0x%X] %s", r1, err) return nil, nil, fmt.Errorf("unexpected error: [NT 0x%X] %s", r1, err)
} }