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-chunker
Commits
ca4d27be
Commit
ca4d27be
authored
Mar 25, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: don't return an empty block at the end
parent
72733e3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
buzhash.go
buzhash.go
+9
-2
No files found.
buzhash.go
View file @
ca4d27be
...
...
@@ -40,9 +40,16 @@ func (b *Buzhash) NextBytes() ([]byte, error) {
n
,
err
:=
io
.
ReadFull
(
b
.
r
,
b
.
buf
[
b
.
n
:
])
if
err
!=
nil
{
if
err
==
io
.
ErrUnexpectedEOF
||
err
==
io
.
EOF
{
if
b
.
n
+
n
<
buzMin
{
buffered
:=
b
.
n
+
n
if
buffered
<
buzMin
{
b
.
err
=
io
.
EOF
res
:=
make
([]
byte
,
b
.
n
+
n
)
// Read nothing? Don't return an empty block.
if
buffered
==
0
{
pool
.
Put
(
b
.
buf
)
b
.
buf
=
nil
return
nil
,
b
.
err
}
res
:=
make
([]
byte
,
buffered
)
copy
(
res
,
b
.
buf
)
pool
.
Put
(
b
.
buf
)
...
...
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