aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/peer.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-13 21:44:00 +0800
committerFelix Lange <fjl@twurst.com>2015-02-13 21:44:00 +0800
commit5110f80bba13e3758ae1836a88afee123df81e3e (patch)
tree0648f72c5955b46179a8205f8e2d2fb7d4988ccb /p2p/peer.go
parent170eb3ac684231dc2ddebc34e7006e0f2b5fc0c1 (diff)
downloaddexon-5110f80bba13e3758ae1836a88afee123df81e3e.tar.gz
dexon-5110f80bba13e3758ae1836a88afee123df81e3e.tar.zst
dexon-5110f80bba13e3758ae1836a88afee123df81e3e.zip
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.
Diffstat (limited to 'p2p/peer.go')
-rw-r--r--p2p/peer.go14
1 files changed, 2 insertions, 12 deletions
diff --git a/p2p/peer.go b/p2p/peer.go
index b61cf96da..f779c1c02 100644
--- a/p2p/peer.go
+++ b/p2p/peer.go
@@ -16,21 +16,11 @@ import (
)
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 (