mirror of
https://github.com/FlipsideCrypto/dcrd.git
synced 2026-02-06 10:56:47 +00:00
Return from syncMiningStateAfterSync if peer disconnected. (#310)
Before this fix, if a peer disconnected before the chain was marked current, its goroutine and memory would hang around until the chain was marked current. This would cause out-of-memory errors. This should also speed up blockchain processing since there are no longer many goroutines calling IsCurrent every 3 seconds.
This commit is contained in:
parent
61dfe146a9
commit
696dcddb23
@ -784,6 +784,9 @@ func (b *blockManager) syncMiningStateAfterSync(sp *serverPeer) {
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
if !sp.Connected() {
|
||||
return
|
||||
}
|
||||
if b.IsCurrent() {
|
||||
msg := wire.NewMsgGetMiningState()
|
||||
sp.QueueMessage(msg, nil)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user