From 4b7bdc3766e1e06ebd6f865f0fdda26f9b331932 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 28 Apr 2015 21:18:08 +0200 Subject: [PATCH] eth: check if downloader is busy before showing log message --- eth/downloader/downloader.go | 4 ++++ eth/handler.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 60d908758..63d202a7f 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -472,3 +472,7 @@ func (d *Downloader) isProcessing() bool { func (d *Downloader) isBusy() bool { return d.isFetchingHashes() || d.isDownloadingBlocks() || d.isProcessing() } + +func (d *Downloader) IsBusy() bool { + return d.isBusy() +} diff --git a/eth/handler.go b/eth/handler.go index d00d00f23..61149049e 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -163,6 +163,11 @@ func (pm *ProtocolManager) synchronise(peer *peer) { if peer.td.Cmp(pm.chainman.Td()) <= 0 { return } + // Check downloader if it's busy so it doesn't show the sync message + // for every attempty + if pm.downloader.IsBusy() { + return + } glog.V(logger.Info).Infof("Synchronisation attempt using %s TD=%v\n", peer.id, peer.td) // Get the hashes from the peer (synchronously)