aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/peer.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-22 01:18:19 +0800
committerobscuren <geffobscura@gmail.com>2015-03-22 01:18:19 +0800
commit7f85608f30a2e34005c8d15566849229c758c2f1 (patch)
tree7aeb9d8bdfda7ec10ea38688a96ed245028764ad /p2p/peer.go
parent09766d1729f7530093aec7e9acd3e5339b2c2028 (diff)
parentfcacfabe1959c4aff6a63cb4e275f65328660601 (diff)
downloaddexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.gz
dexon-7f85608f30a2e34005c8d15566849229c758c2f1.tar.zst
dexon-7f85608f30a2e34005c8d15566849229c758c2f1.zip
Merge branch 'conversion' into develop
Diffstat (limited to 'p2p/peer.go')
-rw-r--r--p2p/peer.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/p2p/peer.go b/p2p/peer.go
index c2c83abfc..6b97ea58d 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,12 +192,13 @@ 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
// connection after this.
rlp.Decode(msg.Payload, &reason)
+ p.Debugf("Disconnect requested: %v\n", reason[0])
p.Disconnect(DiscRequested)
return discRequestedError(reason[0])
case msg.Code < baseProtocolLength: