mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-04 07:06:39 +08:00
Some refactor and cleanup
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
@@ -83,10 +83,7 @@ func (b *stoppedState) status() Status {
|
|||||||
|
|
||||||
func (b *stoppedState) transition(s containerState) error {
|
func (b *stoppedState) transition(s containerState) error {
|
||||||
switch s.(type) {
|
switch s.(type) {
|
||||||
case *runningState:
|
case *runningState, *restoredState:
|
||||||
b.c.state = s
|
|
||||||
return nil
|
|
||||||
case *restoredState:
|
|
||||||
b.c.state = s
|
b.c.state = s
|
||||||
return nil
|
return nil
|
||||||
case *stoppedState:
|
case *stoppedState:
|
||||||
@@ -212,9 +209,7 @@ func (r *restoredState) status() Status {
|
|||||||
|
|
||||||
func (r *restoredState) transition(s containerState) error {
|
func (r *restoredState) transition(s containerState) error {
|
||||||
switch s.(type) {
|
switch s.(type) {
|
||||||
case *stoppedState:
|
case *stoppedState, *runningState:
|
||||||
return nil
|
|
||||||
case *runningState:
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return newStateTransitionError(r, s)
|
return newStateTransitionError(r, s)
|
||||||
|
@@ -295,7 +295,6 @@ func startContainer(context *cli.Context, spec *specs.Spec, create bool) (int, e
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
detach := context.Bool("detach")
|
|
||||||
// Support on-demand socket activation by passing file descriptors into the container init process.
|
// Support on-demand socket activation by passing file descriptors into the container init process.
|
||||||
listenFDs := []*os.File{}
|
listenFDs := []*os.File{}
|
||||||
if os.Getenv("LISTEN_FDS") != "" {
|
if os.Getenv("LISTEN_FDS") != "" {
|
||||||
@@ -307,7 +306,7 @@ func startContainer(context *cli.Context, spec *specs.Spec, create bool) (int, e
|
|||||||
container: container,
|
container: container,
|
||||||
listenFDs: listenFDs,
|
listenFDs: listenFDs,
|
||||||
console: context.String("console"),
|
console: context.String("console"),
|
||||||
detach: detach,
|
detach: context.Bool("detach"),
|
||||||
pidFile: context.String("pid-file"),
|
pidFile: context.String("pid-file"),
|
||||||
create: create,
|
create: create,
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user