aboutsummaryrefslogtreecommitdiffstats
path: root/ethwire
diff options
context:
space:
mode:
Diffstat (limited to 'ethwire')
-rw-r--r--ethwire/messaging.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/ethwire/messaging.go b/ethwire/messaging.go
index 67a866f73..bee6dd526 100644
--- a/ethwire/messaging.go
+++ b/ethwire/messaging.go
@@ -282,8 +282,10 @@ func ReadMessages(conn net.Conn) (msgs []*Msg, err error) {
var buff []byte
var totalBytes int
for {
+ // This is a bit of a cheat actually to make buffering extremely fast.
+ defer recover()
// Give buffering some time
- conn.SetReadDeadline(time.Now().Add(500 * time.Millisecond))
+ conn.SetReadDeadline(time.Now().Add(5 * time.Millisecond))
// Create a new temporarily buffer
b := make([]byte, 1440)
// Wait for a message from this peer