diff options
author | obscuren <geffobscura@gmail.com> | 2014-05-14 17:29:57 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-05-14 17:29:57 +0800 |
commit | 0c1f732c64b7c1380b2f0422ee82d462ea88dc03 (patch) | |
tree | 2e80c21388ee83a0503050e04c89b72695f71737 | |
parent | a4883a029f3585d7e263661c30cbd147f3d5d655 (diff) | |
download | go-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.go | 1 | ||||
-rw-r--r-- | peer.go | 4 |
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") } @@ -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 } |