Commit 3b8c0ad4 authored by Steven Allen's avatar Steven Allen

fix a fetch deadlock on error

fixes https://github.com/ipfs/go-ipfs/issues/5793
parent ff7c0709
......@@ -397,7 +397,10 @@ func EnumerateChildrenAsyncDepth(ctx context.Context, getLinks GetLinks, c cid.C
if shouldVisit {
links, err := getLinks(ctx, ci)
if err != nil {
errChan <- err
select {
case errChan <- err:
case <-fetchersCtx.Done():
}
return
}
......
......@@ -677,6 +677,7 @@ func TestEnumerateAsyncFailsNotFound(t *testing.T) {
b := NodeWithData([]byte("foo2"))
c := NodeWithData([]byte("foo3"))
d := NodeWithData([]byte("foo4"))
e := NodeWithData([]byte("foo5"))
ds := dstest.Mock()
for _, n := range []ipld.Node{a, b, c} {
......@@ -703,6 +704,10 @@ func TestEnumerateAsyncFailsNotFound(t *testing.T) {
t.Fatal(err)
}
if err := parent.AddNodeLink("e", e); err != nil {
t.Fatal(err)
}
err := ds.Add(ctx, parent)
if err != nil {
t.Fatal(err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment