Do not queue messages if the peer isn't connected (e.g. timing out)

This commit is contained in:
obscuren 2014-05-14 11:29:57 +02:00
parent a4883a029f
commit 0c1f732c64
2 changed files with 4 additions and 1 deletions

View File

@ -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")
}

View File

@ -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
}