aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-14 17:29:57 +0800
committerobscuren <geffobscura@gmail.com>2014-05-14 17:29:57 +0800
commit0c1f732c64b7c1380b2f0422ee82d462ea88dc03 (patch)
tree2e80c21388ee83a0503050e04c89b72695f71737 /peer.go
parenta4883a029f3585d7e263661c30cbd147f3d5d655 (diff)
downloadgo-tangerine-0c1f732c64b7c1380b2f0422ee82d462ea88dc03.tar
go-tangerine-0c1f732c64b7c1380b2f0422ee82d462ea88dc03.tar.gz
go-tangerine-0c1f732c64b7c1380b2f0422ee82d462ea88dc03.tar.bz2
go-tangerine-0c1f732c64b7c1380b2f0422ee82d462ea88dc03.tar.lz
go-tangerine-0c1f732c64b7c1380b2f0422ee82d462ea88dc03.tar.xz
go-tangerine-0c1f732c64b7c1380b2f0422ee82d462ea88dc03.tar.zst
go-tangerine-0c1f732c64b7c1380b2f0422ee82d462ea88dc03.zip
Do not queue messages if the peer isn't connected (e.g. timing out)
Diffstat (limited to 'peer.go')
-rw-r--r--peer.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/peer.go b/peer.go
index 932dbdc18..70759f246 100644
--- a/peer.go
+++ b/peer.go
@@ -187,6 +187,10 @@ func NewOutboundPeer(addr string, ethereum *Ethereum, caps Caps) *Peer {
// Outputs any RLP encoded data to the peer
func (p *Peer) QueueMessage(msg *ethwire.Msg) {
+ if atomic.LoadInt32(&p.connected) != 1 {
+ return
+ }
+
p.outputQueue <- msg
}