aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/message.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2014-11-25 23:01:39 +0800
committerFelix Lange <fjl@twurst.com>2014-11-25 23:01:39 +0800
commit9b85002b700500d421ba7e13ac2062a6b8090a83 (patch)
tree1cfa335fe194c391b946f9efb9760417729330ef /p2p/message.go
parentf816fdcb692d64cd5196b08c678550060e7e7df7 (diff)
downloaddexon-9b85002b700500d421ba7e13ac2062a6b8090a83.tar.gz
dexon-9b85002b700500d421ba7e13ac2062a6b8090a83.tar.zst
dexon-9b85002b700500d421ba7e13ac2062a6b8090a83.zip
p2p: remove Msg.Value and MsgLoop
Diffstat (limited to 'p2p/message.go')
-rw-r--r--p2p/message.go32
1 files changed, 0 insertions, 32 deletions
diff --git a/p2p/message.go b/p2p/message.go
index 845c832f0..d3b8b74d4 100644
--- a/p2p/message.go
+++ b/p2p/message.go
@@ -41,13 +41,6 @@ func encodePayload(params ...interface{}) []byte {
return buf.Bytes()
}
-// Value returns the decoded RLP payload items in a message.
-func (msg Msg) Value() (*ethutil.Value, error) {
- var v []interface{}
- err := msg.Decode(&v)
- return ethutil.NewValue(v), err
-}
-
// Decode parse the RLP content of a message into
// the given value, which must be a pointer.
//
@@ -84,31 +77,6 @@ type MsgReadWriter interface {
MsgWriter
}
-// MsgLoop reads messages off the given reader and
-// calls the handler function for each decoded message until
-// it returns an error or the peer connection is closed.
-//
-// If a message is larger than the given maximum size,
-// MsgLoop returns an appropriate error.
-func MsgLoop(r MsgReader, maxsize uint32, f func(code uint64, data *ethutil.Value) error) error {
- for {
- msg, err := r.ReadMsg()
- if err != nil {
- return err
- }
- if msg.Size > maxsize {
- return newPeerError(errInvalidMsg, "size %d exceeds maximum size of %d", msg.Size, maxsize)
- }
- value, err := msg.Value()
- if err != nil {
- return err
- }
- if err := f(msg.Code, value); err != nil {
- return err
- }
- }
-}
-
var magicToken = []byte{34, 64, 8, 145}
func writeMsg(w io.Writer, msg Msg) error {