diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-29 23:54:43 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-10-29 23:54:43 +0800 |
commit | 8202bae070ae80db572dc37895e52f3e4e75585b (patch) | |
tree | 0af060bdc0da642214b09b4bb863a567890b0fcd /eth/sync.go | |
parent | 56f8699a6c6bfe613d2ab28c47631a1f4a29e36f (diff) | |
parent | 667987e7d0a677fbb0e2c54c31efedb11ebc5f5d (diff) | |
download | dexon-8202bae070ae80db572dc37895e52f3e4e75585b.tar dexon-8202bae070ae80db572dc37895e52f3e4e75585b.tar.gz dexon-8202bae070ae80db572dc37895e52f3e4e75585b.tar.bz2 dexon-8202bae070ae80db572dc37895e52f3e4e75585b.tar.lz dexon-8202bae070ae80db572dc37895e52f3e4e75585b.tar.xz dexon-8202bae070ae80db572dc37895e52f3e4e75585b.tar.zst dexon-8202bae070ae80db572dc37895e52f3e4e75585b.zip |
Merge pull request #1939 from karalabe/fix-blocked-sync-goroutines
eth: don't block sync goroutines that short circuit
Diffstat (limited to 'eth/sync.go')
-rw-r--r-- | eth/sync.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/eth/sync.go b/eth/sync.go index b69a24556..bbf2abc04 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -170,13 +170,16 @@ func (pm *ProtocolManager) synchronise(peer *peer) { if pm.fastSync { mode = downloader.FastSync } - pm.downloader.Synchronise(peer.id, peer.Head(), peer.Td(), mode) - + if err := pm.downloader.Synchronise(peer.id, peer.Head(), peer.Td(), mode); err != nil { + return + } // If fast sync was enabled, and we synced up, disable it if pm.fastSync { + // Wait until all pending imports finish processing for pm.downloader.Synchronising() { time.Sleep(100 * time.Millisecond) } + // Disable fast sync if we indeed have something in our chain if pm.blockchain.CurrentBlock().NumberU64() > 0 { glog.V(logger.Info).Infof("fast sync complete, auto disabling") pm.fastSync = false |