@cryptotaxi247 / kubo / commits / 00de34431

fix: close resolve channel before returning it

Steven Allen committed Jun 17, 2020 at 19:42 UTC 00de344318e60f2872e53c35240db92ae6f82727
1 file changed +4 -1
namesys/namesys.go
+4 -1
@@ -86,16 +86,19 @@ func (ns *mpns) Resolve(ctx context.Context, name string, options ...opts.Resolv
86 }
87
88 func (ns *mpns) ResolveAsync(ctx context.Context, name string, options ...opts.ResolveOpt) <-chan Result {
89 - res := make(chan Result, 1)
89 if strings.HasPrefix(name, "/ipfs/") {
90 p, err := path.ParsePath(name)
91 + res := make(chan Result, 1)
92 res <- Result{p, err}
93 + close(res)
94 return res
95 }
96
97 if !strings.HasPrefix(name, "/") {
98 p, err := path.ParsePath("/ipfs/" + name)
99 + res := make(chan Result, 1)
100 res <- Result{p, err}
101 + close(res)
102 return res
103 }
104