runtime: fix shutdown runc v2 service

Signed-off-by: IceberGu <wei.cai-nat@daocloud.io>
This commit is contained in:
IceberGu 2021-02-02 15:36:49 +08:00
parent a39478ab9a
commit b458583b76
No known key found for this signature in database
GPG Key ID: F1632F7124070DD4

View File

@ -662,9 +662,10 @@ func (s *service) Connect(ctx context.Context, r *taskAPI.ConnectRequest) (*task
func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (*ptypes.Empty, error) {
s.mu.Lock()
defer s.mu.Unlock()
// return out if the shim is still servicing containers
if len(s.containers) > 0 {
s.mu.Unlock()
return empty, nil
}
s.cancel()