Fix USB/IP lint and vet issues

This commit is contained in:
世界
2026-04-24 05:57:10 +08:00
parent 7ab2269998
commit e94a99d5b9
4 changed files with 6 additions and 11 deletions
+1 -5
View File
@@ -155,11 +155,7 @@ func (c *ClientService) initializeWorkers() {
func (c *ClientService) run() {
defer c.wg.Done()
immediate := true
for {
if !immediate && !sleepCtx(c.ctx, clientReconnectDelay) {
break
}
for immediate := true; immediate || sleepCtx(c.ctx, clientReconnectDelay); {
err := c.runSession()
if c.ctx.Err() != nil {
break
+1 -5
View File
@@ -172,11 +172,7 @@ func (c *ClientService) initializeWorkers() {
func (c *ClientService) run() {
defer c.wg.Done()
immediate := true
for {
if !immediate && !sleepCtx(c.ctx, clientReconnectDelay) {
break
}
for immediate := true; immediate || sleepCtx(c.ctx, clientReconnectDelay); {
err := c.runSession()
if c.ctx.Err() != nil {
break
+1
View File
@@ -271,6 +271,7 @@ func (s *ServerService) acceptLoop(ln net.Listener) {
if E.IsClosed(err) {
return
}
//nolint:staticcheck // Keep parity with Linux accept retry handling.
if netError, isNetError := err.(net.Error); isNetError && netError.Temporary() {
s.logger.Error("accept: ", err)
if !sleepCtx(s.ctx, 200*time.Millisecond) {
+3 -1
View File
@@ -64,6 +64,7 @@ type darwinCIMessage struct {
control uint32
data0 uint32
data1 uint64
buffer unsafe.Pointer
}
type darwinCITransfer struct {
@@ -255,6 +256,7 @@ func (s *darwinUSBHostEndpointSM) currentTransfer() darwinCITransfer {
control: uint32(ptr.control),
data0: uint32(ptr.data0),
data1: uint64(ptr.data1),
buffer: C.box_usbhost_ci_normal_buffer(ptr),
},
}
}
@@ -313,7 +315,7 @@ func (m darwinCIMessage) normalLength() uint32 {
}
func (m darwinCIMessage) bufferPointer() unsafe.Pointer {
return unsafe.Pointer(uintptr(m.data1))
return m.buffer
}
func darwinCIFrameTimestamp() uint64 {