mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 15:04:22 +00:00
Simplify Service/Reactor pattern
This commit is contained in:
+4
-2
@@ -68,12 +68,14 @@ func NewBlockPool(start int, requestsCh chan<- BlockRequest, timeoutsCh chan<- s
|
||||
return bp
|
||||
}
|
||||
|
||||
func (pool *BlockPool) AfterStart() {
|
||||
func (pool *BlockPool) OnStart() {
|
||||
pool.BaseService.OnStart()
|
||||
pool.repeater = NewRepeatTimer("", requestIntervalMS*time.Millisecond)
|
||||
go pool.run()
|
||||
}
|
||||
|
||||
func (pool *BlockPool) AfterStop() {
|
||||
func (pool *BlockPool) OnStop() {
|
||||
pool.BaseService.OnStop()
|
||||
pool.repeater.Stop()
|
||||
}
|
||||
|
||||
|
||||
@@ -76,14 +76,16 @@ func NewBlockchainReactor(state *sm.State, store *BlockStore, sync bool) *Blockc
|
||||
return bcR
|
||||
}
|
||||
|
||||
func (bcR *BlockchainReactor) AfterStart() {
|
||||
func (bcR *BlockchainReactor) OnStart() {
|
||||
bcR.BaseReactor.OnStart()
|
||||
if bcR.sync {
|
||||
bcR.pool.Start()
|
||||
go bcR.poolRoutine()
|
||||
}
|
||||
}
|
||||
|
||||
func (bcR *BlockchainReactor) AfterStop() {
|
||||
func (bcR *BlockchainReactor) OnStop() {
|
||||
bcR.BaseReactor.OnStop()
|
||||
bcR.pool.Stop()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user