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
p2p
go-yamux
Commits
c8e9b3ed
Unverified
Commit
c8e9b3ed
authored
Feb 17, 2021
by
Marten Seemann
Committed by
GitHub
Feb 17, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38 from libp2p/dont-reimplement-readfull
don't reimplement io.ReadFull
parents
67e9bf6d
083dccd3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
13 deletions
+2
-13
util.go
util.go
+2
-13
No files found.
util.go
View file @
c8e9b3ed
...
...
@@ -151,21 +151,10 @@ func (s *segmentedBuffer) Read(b []byte) (int, error) {
func
(
s
*
segmentedBuffer
)
Append
(
input
io
.
Reader
,
length
int
)
error
{
dst
:=
pool
.
Get
(
length
)
n
:=
0
read
:=
0
var
err
error
for
n
<
length
&&
err
==
nil
{
read
,
err
=
input
.
Read
(
dst
[
n
:
])
n
+=
read
}
n
,
err
:=
io
.
ReadFull
(
input
,
dst
)
if
err
==
io
.
EOF
{
if
length
==
n
{
err
=
nil
}
else
{
err
=
io
.
ErrUnexpectedEOF
}
err
=
io
.
ErrUnexpectedEOF
}
s
.
bm
.
Lock
()
defer
s
.
bm
.
Unlock
()
if
n
>
0
{
...
...
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