eth/downloader: add a user sync notificaton

This commit is contained in:
Péter Szilágyi 2015-05-13 16:03:05 +03:00
parent ec57aa64cd
commit 48ee0777a5
1 changed files with 5 additions and 0 deletions

View File

@ -65,6 +65,7 @@ type Downloader struct {
// Status
synchronising int32
notified int32
// Channels
newPeerCh chan *peer
@ -128,6 +129,10 @@ func (d *Downloader) Synchronise(id string, hash common.Hash) error {
}
defer atomic.StoreInt32(&d.synchronising, 0)
// Post a user notification of the sync (only once per session)
if atomic.CompareAndSwapInt32(&d.notified, 0, 1) {
glog.V(logger.Info).Infoln("Block synchronisation started")
}
// Create cancel channel for aborting mid-flight
d.cancelLock.Lock()
d.cancelCh = make(chan struct{})