Fix a potential panic

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2018-02-22 03:16:41 +00:00
parent 7f5687c801
commit f5390d01d6
3 changed files with 29 additions and 9 deletions

View File

@@ -37,7 +37,7 @@ type Sandbox struct {
// CNI network namespace client
NetNS *NetNS
// StopCh is used to propagate the stop information of the sandbox.
store.StopCh
*store.StopCh
}
// NewSandbox creates an internally used sandbox type. This functions reminds
@@ -46,7 +46,7 @@ func NewSandbox(metadata Metadata, status Status) Sandbox {
s := Sandbox{
Metadata: metadata,
Status: StoreStatus(status),
StopCh: store.StopCh(make(chan struct{})),
StopCh: store.NewStopCh(),
}
if status.State == StateNotReady {
s.Stop()