From 4a59b557e7dd2034fa44a406ee3a8fc51638a32a Mon Sep 17 00:00:00 2001 From: Alec Brickner Date: Sat, 12 May 2018 03:35:42 -0700 Subject: [PATCH] Fix goroutine leak in dag put License: MIT Signed-off-by: Alec Brickner --- core/commands/dag/dag.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/commands/dag/dag.go b/core/commands/dag/dag.go index 2e069a60f72..d456f70e244 100644 --- a/core/commands/dag/dag.go +++ b/core/commands/dag/dag.go @@ -128,7 +128,12 @@ into an object of the specified format. cid := nds[0].Cid() cids.Add(cid) - outChan <- &OutputObject{Cid: cid} + + select { + case outChan <- &OutputObject{Cid: cid}: + case <-req.Context().Done(): + return nil + } } if err := b.Commit(); err != nil {