aboutsummaryrefslogtreecommitdiffstats
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
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)
-rw-r--r--ethchain/state_manager.go1
-rw-r--r--peer.go4
2 files changed, 4 insertions, 1 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go
index 8f1eb1ce5..f830f2022 100644
--- a/ethchain/state_manager.go
+++ b/ethchain/state_manager.go
@@ -199,7 +199,6 @@ func (sm *StateManager) ProcessBlock(block *Block, dontReact bool) error {
}
sm.Ethereum.Broadcast(ethwire.MsgBlockTy, []interface{}{block.Value().Val})
-
} else {
fmt.Println("total diff failed")
}
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
}