aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/peer.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-19 22:11:02 +0800
committerFelix Lange <fjl@twurst.com>2015-03-19 22:11:02 +0800
commit5ba51594c7eb1f04b3636e6413de6d4eb70228d2 (patch)
tree71614118e0026a69c72f4f900a51c26055f00167 /p2p/peer.go
parent4811f460e7aad37c6c6867df0461a5fa162b5f2c (diff)
downloadgo-tangerine-5ba51594c7eb1f04b3636e6413de6d4eb70228d2.tar
go-tangerine-5ba51594c7eb1f04b3636e6413de6d4eb70228d2.tar.gz
go-tangerine-5ba51594c7eb1f04b3636e6413de6d4eb70228d2.tar.bz2
go-tangerine-5ba51594c7eb1f04b3636e6413de6d4eb70228d2.tar.lz
go-tangerine-5ba51594c7eb1f04b3636e6413de6d4eb70228d2.tar.xz
go-tangerine-5ba51594c7eb1f04b3636e6413de6d4eb70228d2.tar.zst
go-tangerine-5ba51594c7eb1f04b3636e6413de6d4eb70228d2.zip
p2p: use package rlp to encode messages
Message encoding functions have been renamed to catch any uses. The switch to the new encoder can cause subtle incompatibilities. If there are any users outside of our tree, they will at least be alerted that there was a change. NewMsg no longer exists. The replacements for EncodeMsg are called Send and SendItems.
Diffstat (limited to 'p2p/peer.go')
-rw-r--r--p2p/peer.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/p2p/peer.go b/p2p/peer.go
index c2c83abfc..ee5199d78 100644
--- a/p2p/peer.go
+++ b/p2p/peer.go
@@ -132,7 +132,7 @@ loop:
select {
case <-ping.C:
go func() {
- if err := EncodeMsg(p.rw, pingMsg, nil); err != nil {
+ if err := SendItems(p.rw, pingMsg); err != nil {
p.protoErr <- err
return
}
@@ -161,7 +161,7 @@ loop:
func (p *Peer) politeDisconnect(reason DiscReason) {
done := make(chan struct{})
go func() {
- EncodeMsg(p.rw, discMsg, uint(reason))
+ SendItems(p.rw, discMsg, uint(reason))
// Wait for the other side to close the connection.
// Discard any data that they send until then.
io.Copy(ioutil.Discard, p.conn)
@@ -192,7 +192,7 @@ func (p *Peer) handle(msg Msg) error {
switch {
case msg.Code == pingMsg:
msg.Discard()
- go EncodeMsg(p.rw, pongMsg)
+ go SendItems(p.rw, pongMsg)
case msg.Code == discMsg:
var reason [1]DiscReason
// no need to discard or for error checking, we'll close the