Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
4b13b05f
Commit
4b13b05f
authored
Feb 02, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #722 from jbenet/fix/readerclose
ensure dagreaders are cleaned up after 'cat' command finishes
parents
7821f576
061a8663
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
core/commands/cat.go
core/commands/cat.go
+4
-5
No files found.
core/commands/cat.go
View file @
4b13b05f
...
...
@@ -8,6 +8,7 @@ import (
path
"github.com/jbenet/go-ipfs/path"
uio
"github.com/jbenet/go-ipfs/unixfs/io"
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/cheggaaa/pb"
)
...
...
@@ -32,9 +33,7 @@ it contains.
return
}
readers
:=
make
([]
io
.
Reader
,
0
,
len
(
req
.
Arguments
()))
readers
,
length
,
err
:=
cat
(
node
,
req
.
Arguments
())
readers
,
length
,
err
:=
cat
(
req
.
Context
()
.
Context
,
node
,
req
.
Arguments
())
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
...
...
@@ -59,7 +58,7 @@ it contains.
},
}
func
cat
(
node
*
core
.
IpfsNode
,
paths
[]
string
)
([]
io
.
Reader
,
uint64
,
error
)
{
func
cat
(
ctx
context
.
Context
,
node
*
core
.
IpfsNode
,
paths
[]
string
)
([]
io
.
Reader
,
uint64
,
error
)
{
readers
:=
make
([]
io
.
Reader
,
0
,
len
(
paths
))
length
:=
uint64
(
0
)
for
_
,
fpath
:=
range
paths
{
...
...
@@ -68,7 +67,7 @@ func cat(node *core.IpfsNode, paths []string) ([]io.Reader, uint64, error) {
return
nil
,
0
,
err
}
read
,
err
:=
uio
.
NewDagReader
(
node
.
Context
()
,
dagnode
,
node
.
DAG
)
read
,
err
:=
uio
.
NewDagReader
(
ctx
,
dagnode
,
node
.
DAG
)
if
err
!=
nil
{
return
nil
,
0
,
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment