Skip to content

Commit

Permalink
criuSwrk: simplify switch
Browse files Browse the repository at this point in the history
1. Use "switch t" since we only check t.

2. Remove unneeded t assignment.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed Aug 3, 2023
1 parent cb981e5 commit e4478e9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions libcontainer/criu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,15 +971,14 @@ func (c *Container) criuSwrk(process *Process, req *criurpc.CriuReq, opts *CriuO
}

t := resp.GetType()
switch {
case t == criurpc.CriuReqType_FEATURE_CHECK:
switch t {
case criurpc.CriuReqType_FEATURE_CHECK:
logrus.Debugf("Feature check says: %s", resp)
criuFeatures = resp.GetFeatures()
case t == criurpc.CriuReqType_NOTIFY:
case criurpc.CriuReqType_NOTIFY:
if err := c.criuNotifications(resp, process, cmd, opts, extFds, oob[:oobn]); err != nil {
return err
}
t = criurpc.CriuReqType_NOTIFY
req = &criurpc.CriuReq{
Type: &t,
NotifySuccess: proto.Bool(true),
Expand All @@ -993,9 +992,9 @@ func (c *Container) criuSwrk(process *Process, req *criurpc.CriuReq, opts *CriuO
return err
}
continue
case t == criurpc.CriuReqType_RESTORE:
case t == criurpc.CriuReqType_DUMP:
case t == criurpc.CriuReqType_PRE_DUMP:
case criurpc.CriuReqType_RESTORE:
case criurpc.CriuReqType_DUMP:
case criurpc.CriuReqType_PRE_DUMP:
default:
return fmt.Errorf("unable to parse the response %s", resp.String())
}
Expand Down

0 comments on commit e4478e9

Please sign in to comment.