p2p: improve read deadlines

There are now two deadlines, frameReadTimeout and payloadReadTimeout.

The frame timeout is longer and allows for connections that are idle.
The message timeout is still short and ensures that we don't get stuck
in the middle of a message.
This commit is contained in:
Felix Lange
2015-02-13 14:44:00 +01:00
parent 170eb3ac68
commit 5110f80bba
2 changed files with 27 additions and 15 deletions

View File

@ -15,22 +15,12 @@ import (
"github.com/ethereum/go-ethereum/rlp"
)
const (
// maximum amount of time allowed for reading a message
msgReadTimeout = 5 * time.Second
// maximum amount of time allowed for writing a message
msgWriteTimeout = 5 * time.Second
// messages smaller than this many bytes will be read at
// once before passing them to a protocol.
wholePayloadSize = 64 * 1024
disconnectGracePeriod = 2 * time.Second
)
const (
baseProtocolVersion = 2
baseProtocolLength = uint64(16)
baseProtocolMaxMsgSize = 10 * 1024 * 1024
disconnectGracePeriod = 2 * time.Second
)
const (