diff options
author | obscuren <geffobscura@gmail.com> | 2014-09-17 21:57:32 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-09-17 21:57:32 +0800 |
commit | eb32fe20c8513b936faf908985d021caa87d5b0d (patch) | |
tree | be20ab8f813d8c89d31c0af5fa2d13997205cd34 | |
parent | fd041d91ee9f4be2d4705a32dc16698c89622c85 (diff) | |
download | go-tangerine-eb32fe20c8513b936faf908985d021caa87d5b0d.tar go-tangerine-eb32fe20c8513b936faf908985d021caa87d5b0d.tar.gz go-tangerine-eb32fe20c8513b936faf908985d021caa87d5b0d.tar.bz2 go-tangerine-eb32fe20c8513b936faf908985d021caa87d5b0d.tar.lz go-tangerine-eb32fe20c8513b936faf908985d021caa87d5b0d.tar.xz go-tangerine-eb32fe20c8513b936faf908985d021caa87d5b0d.tar.zst go-tangerine-eb32fe20c8513b936faf908985d021caa87d5b0d.zip |
Rewrite
-rw-r--r-- | ethwire/messaging.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ethwire/messaging.go b/ethwire/messaging.go index 2161ce27f..b1cefc0ae 100644 --- a/ethwire/messaging.go +++ b/ethwire/messaging.go @@ -96,7 +96,7 @@ func ReadMessages(conn net.Conn) (msgs []*Msg, err error) { for { // Give buffering some time - conn.SetReadDeadline(time.Now().Add(100 * time.Millisecond)) + conn.SetReadDeadline(time.Now().Add(5 * time.Millisecond)) // Create a new temporarily buffer b := make([]byte, 1440) n, _ := conn.Read(b) @@ -110,6 +110,9 @@ func ReadMessages(conn net.Conn) (msgs []*Msg, err error) { } if n == 0 && len(buff) == 0 { + // If there's nothing on the wire wait for a bit + time.Sleep(200) + continue } |