discovery/sync_manager: make setHistoricalSyncer closure
This commit is contained in:
parent
72fbd1283b
commit
ef0cd82c1f
@ -214,6 +214,11 @@ func (m *SyncManager) syncerHandler() {
|
|||||||
initialHistoricalSyncSignal chan struct{}
|
initialHistoricalSyncSignal chan struct{}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
setHistoricalSyncer := func(s *GossipSyncer) {
|
||||||
|
initialHistoricalSyncer = s
|
||||||
|
initialHistoricalSyncSignal = s.ResetSyncedSignal()
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
// A new peer has been connected, so we'll create its
|
// A new peer has been connected, so we'll create its
|
||||||
@ -297,8 +302,7 @@ func (m *SyncManager) syncerHandler() {
|
|||||||
// keep track of the corresponding syncer to properly
|
// keep track of the corresponding syncer to properly
|
||||||
// handle disconnects. We'll also use a signal to know
|
// handle disconnects. We'll also use a signal to know
|
||||||
// when the historical sync completed.
|
// when the historical sync completed.
|
||||||
initialHistoricalSyncer = s
|
setHistoricalSyncer(s)
|
||||||
initialHistoricalSyncSignal = s.ResetSyncedSignal()
|
|
||||||
|
|
||||||
// An existing peer has disconnected, so we'll tear down its
|
// An existing peer has disconnected, so we'll tear down its
|
||||||
// corresponding GossipSyncer.
|
// corresponding GossipSyncer.
|
||||||
@ -337,8 +341,7 @@ func (m *SyncManager) syncerHandler() {
|
|||||||
"GossipSyncer(%v) with GossipSyncer(%x)",
|
"GossipSyncer(%v) with GossipSyncer(%x)",
|
||||||
staleSyncer.peer, s.cfg.peerPub)
|
staleSyncer.peer, s.cfg.peerPub)
|
||||||
|
|
||||||
initialHistoricalSyncer = s
|
setHistoricalSyncer(s)
|
||||||
initialHistoricalSyncSignal = s.ResetSyncedSignal()
|
|
||||||
|
|
||||||
// Our initial historical sync signal has completed, so we'll
|
// Our initial historical sync signal has completed, so we'll
|
||||||
// nil all of the relevant fields as they're no longer needed.
|
// nil all of the relevant fields as they're no longer needed.
|
||||||
@ -398,8 +401,7 @@ func (m *SyncManager) syncerHandler() {
|
|||||||
// where our previous historical sync peer did not
|
// where our previous historical sync peer did not
|
||||||
// respond to our queries and we haven't ingested as
|
// respond to our queries and we haven't ingested as
|
||||||
// much of the graph as we should.
|
// much of the graph as we should.
|
||||||
initialHistoricalSyncer = s
|
setHistoricalSyncer(s)
|
||||||
initialHistoricalSyncSignal = s.ResetSyncedSignal()
|
|
||||||
|
|
||||||
case <-m.quit:
|
case <-m.quit:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user