Fix USBIP parsing and lifecycle handling

This commit is contained in:
世界
2026-04-21 21:45:24 +08:00
parent 323b406971
commit ad5b1de82d
3 changed files with 18 additions and 13 deletions
+1 -7
View File
@@ -312,12 +312,7 @@ func (c *ClientService) attemptAttach(busid string) (int, error) {
if err != nil {
return -1, E.Cause(err, "dial ", c.serverAddr)
}
success := false
defer func() {
if !success {
conn.Close()
}
}()
defer conn.Close()
if err := WriteOpReqImport(conn, busid); err != nil {
return -1, E.Cause(err, "write OP_REQ_IMPORT")
}
@@ -353,7 +348,6 @@ func (c *ClientService) attemptAttach(busid string) (int, error) {
if err := vhciAttach(port, file.Fd(), info.DevID(), info.Speed); err != nil {
return -1, E.Cause(err, "vhci attach")
}
success = true
return port, nil
}