@@ -137,7 +137,7 @@ func (em *eventMonitor) startSandboxExitMonitor(ctx context.Context, id string,
137137
138138 sb , err := em .c .sandboxStore .Get (e .ID )
139139 if err == nil {
140- if err := handleSandboxExit (dctx , e , sb ); err != nil {
140+ if err := handleSandboxExit (dctx , e , sb , em . c ); err != nil {
141141 return err
142142 }
143143 return nil
@@ -188,7 +188,7 @@ func (em *eventMonitor) startContainerExitMonitor(ctx context.Context, id string
188188
189189 cntr , err := em .c .containerStore .Get (e .ID )
190190 if err == nil {
191- if err := handleContainerExit (dctx , e , cntr ); err != nil {
191+ if err := handleContainerExit (dctx , e , cntr , em . c ); err != nil {
192192 return err
193193 }
194194 return nil
@@ -314,7 +314,7 @@ func (em *eventMonitor) handleEvent(any interface{}) error {
314314 // Use ID instead of ContainerID to rule out TaskExit event for exec.
315315 cntr , err := em .c .containerStore .Get (e .ID )
316316 if err == nil {
317- if err := handleContainerExit (ctx , e , cntr ); err != nil {
317+ if err := handleContainerExit (ctx , e , cntr , em . c ); err != nil {
318318 return fmt .Errorf ("failed to handle container TaskExit event: %w" , err )
319319 }
320320 return nil
@@ -323,7 +323,7 @@ func (em *eventMonitor) handleEvent(any interface{}) error {
323323 }
324324 sb , err := em .c .sandboxStore .Get (e .ID )
325325 if err == nil {
326- if err := handleSandboxExit (ctx , e , sb ); err != nil {
326+ if err := handleSandboxExit (ctx , e , sb , em . c ); err != nil {
327327 return fmt .Errorf ("failed to handle sandbox TaskExit event: %w" , err )
328328 }
329329 return nil
@@ -363,7 +363,7 @@ func (em *eventMonitor) handleEvent(any interface{}) error {
363363}
364364
365365// handleContainerExit handles TaskExit event for container.
366- func handleContainerExit (ctx context.Context , e * eventtypes.TaskExit , cntr containerstore.Container ) error {
366+ func handleContainerExit (ctx context.Context , e * eventtypes.TaskExit , cntr containerstore.Container , c * criService ) error {
367367 // Attach container IO so that `Delete` could cleanup the stream properly.
368368 task , err := cntr .Container .Task (ctx ,
369369 func (* containerdio.FIFOSet ) (containerdio.IO , error ) {
@@ -461,7 +461,7 @@ func handleContainerExit(ctx context.Context, e *eventtypes.TaskExit, cntr conta
461461}
462462
463463// handleSandboxExit handles TaskExit event for sandbox.
464- func handleSandboxExit (ctx context.Context , e * eventtypes.TaskExit , sb sandboxstore.Sandbox ) error {
464+ func handleSandboxExit (ctx context.Context , e * eventtypes.TaskExit , sb sandboxstore.Sandbox , c * criService ) error {
465465 // No stream attached to sandbox container.
466466 task , err := sb .Container .Task (ctx , nil )
467467 if err != nil {
0 commit comments