criuSwrk: simplify switch

1. Use "switch t" since we only check t.

2. Remove unneeded t assignment.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2023-08-03 10:27:14 -07:00
parent cb981e510b
commit e4478e9fff
+6 -7
View File
@@ -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),
@@ -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())
}