Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
54b11063
Commit
54b11063
authored
May 05, 2015
by
Juan Batiz-Benet
Browse files
Merge pull request #1181 from ipfs/fix/mega-read
quick fix for OOM panic that has been plaguing us
parents
98c4e3f6
333ef67d
Changes
1
Show whitespace changes
Inline
Side-by-side
crypto/secio/rw.go
View file @
54b11063
...
@@ -15,6 +15,10 @@ import (
...
@@ -15,6 +15,10 @@ import (
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
)
)
const
MaxMsgSize
=
8
*
1024
*
1024
var
ErrMaxMessageSize
=
errors
.
New
(
"attempted to read message larger than max size"
)
// ErrMACInvalid signals that a MAC verification failed
// ErrMACInvalid signals that a MAC verification failed
var
ErrMACInvalid
=
errors
.
New
(
"MAC verification failed"
)
var
ErrMACInvalid
=
errors
.
New
(
"MAC verification failed"
)
...
@@ -130,6 +134,10 @@ func (r *etmReader) Read(buf []byte) (int, error) {
...
@@ -130,6 +134,10 @@ func (r *etmReader) Read(buf []byte) (int, error) {
return
0
,
err
return
0
,
err
}
}
if
fullLen
>
MaxMsgSize
{
return
0
,
ErrMaxMessageSize
}
buf2
:=
buf
buf2
:=
buf
changed
:=
false
changed
:=
false
// if not enough space, allocate a new buffer.
// if not enough space, allocate a new buffer.
...
...
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