aboutsummaryrefslogtreecommitdiffstats
path: root/ethwire
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-14 17:52:16 +0800
committerobscuren <geffobscura@gmail.com>2014-05-14 17:52:16 +0800
commit7c0df348f86d4ee47111b57b83fb1613e6338e05 (patch)
tree31105b8889ab99ca6e11a5e040ce19a7c7e785d4 /ethwire
parent0c1f732c64b7c1380b2f0422ee82d462ea88dc03 (diff)
downloadgo-tangerine-7c0df348f86d4ee47111b57b83fb1613e6338e05.tar.gz
go-tangerine-7c0df348f86d4ee47111b57b83fb1613e6338e05.tar.zst
go-tangerine-7c0df348f86d4ee47111b57b83fb1613e6338e05.zip
Increased deadline
Diffstat (limited to 'ethwire')
-rw-r--r--ethwire/messaging.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/ethwire/messaging.go b/ethwire/messaging.go
index b622376f3..cc0e7a9a0 100644
--- a/ethwire/messaging.go
+++ b/ethwire/messaging.go
@@ -69,6 +69,12 @@ func NewMessage(msgType MsgType, data interface{}) *Msg {
}
func ReadMessage(data []byte) (msg *Msg, remaining []byte, done bool, err error) {
+ defer func() {
+ if r := recover(); r != nil {
+ panic(fmt.Sprintf("message error %d %v", len(data), data))
+ }
+ }()
+
if len(data) == 0 {
return nil, nil, true, nil
}
@@ -124,7 +130,7 @@ func ReadMessages(conn net.Conn) (msgs []*Msg, err error) {
var totalBytes int
for {
// Give buffering some time
- conn.SetReadDeadline(time.Now().Add(20 * time.Millisecond))
+ conn.SetReadDeadline(time.Now().Add(500 * time.Millisecond))
// Create a new temporarily buffer
b := make([]byte, 1440)
// Wait for a message from this peer
@@ -134,7 +140,6 @@ func ReadMessages(conn net.Conn) (msgs []*Msg, err error) {
fmt.Println("err now", err)
return nil, err
} else {
- fmt.Println("IOF NOW")
break
}