mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-29 00:32:14 +00:00
QuitService->BaseService
This commit is contained in:
parent
9a089482dc
commit
480f44f16c
@ -32,7 +32,7 @@ var peerTimeoutSeconds = time.Duration(15) // not const so we can override with
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
type BlockPool struct {
|
type BlockPool struct {
|
||||||
QuitService
|
BaseService
|
||||||
startTime time.Time
|
startTime time.Time
|
||||||
|
|
||||||
mtx sync.Mutex
|
mtx sync.Mutex
|
||||||
@ -58,19 +58,19 @@ func NewBlockPool(start int, requestsCh chan<- BlockRequest, timeoutsCh chan<- s
|
|||||||
requestsCh: requestsCh,
|
requestsCh: requestsCh,
|
||||||
timeoutsCh: timeoutsCh,
|
timeoutsCh: timeoutsCh,
|
||||||
}
|
}
|
||||||
bp.QuitService = *NewQuitService(log, "BlockPool", bp)
|
bp.BaseService = *NewBaseService(log, "BlockPool", bp)
|
||||||
return bp
|
return bp
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pool *BlockPool) OnStart() error {
|
func (pool *BlockPool) OnStart() error {
|
||||||
pool.QuitService.OnStart()
|
pool.BaseService.OnStart()
|
||||||
go pool.makeRequestersRoutine()
|
go pool.makeRequestersRoutine()
|
||||||
pool.startTime = time.Now()
|
pool.startTime = time.Now()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pool *BlockPool) OnStop() {
|
func (pool *BlockPool) OnStop() {
|
||||||
pool.QuitService.OnStop()
|
pool.BaseService.OnStop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run spawns requesters as needed.
|
// Run spawns requesters as needed.
|
||||||
@ -383,7 +383,7 @@ func (peer *bpPeer) onTimeout() {
|
|||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
type bpRequester struct {
|
type bpRequester struct {
|
||||||
QuitService
|
BaseService
|
||||||
pool *BlockPool
|
pool *BlockPool
|
||||||
height int
|
height int
|
||||||
gotBlockCh chan struct{}
|
gotBlockCh chan struct{}
|
||||||
@ -404,12 +404,12 @@ func newBPRequester(pool *BlockPool, height int) *bpRequester {
|
|||||||
peerID: "",
|
peerID: "",
|
||||||
block: nil,
|
block: nil,
|
||||||
}
|
}
|
||||||
bpr.QuitService = *NewQuitService(nil, "bpRequester", bpr)
|
bpr.BaseService = *NewBaseService(nil, "bpRequester", bpr)
|
||||||
return bpr
|
return bpr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bpr *bpRequester) OnStart() error {
|
func (bpr *bpRequester) OnStart() error {
|
||||||
bpr.QuitService.OnStart()
|
bpr.BaseService.OnStart()
|
||||||
go bpr.requestRoutine()
|
go bpr.requestRoutine()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ const (
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
type ConsensusReactor struct {
|
type ConsensusReactor struct {
|
||||||
p2p.BaseReactor // QuitService + p2p.Switch
|
p2p.BaseReactor // BaseService + p2p.Switch
|
||||||
|
|
||||||
blockStore *bc.BlockStore
|
blockStore *bc.BlockStore
|
||||||
conS *ConsensusState
|
conS *ConsensusState
|
||||||
|
@ -211,7 +211,7 @@ func (ti *timeoutInfo) String() string {
|
|||||||
|
|
||||||
// Tracks consensus state across block heights and rounds.
|
// Tracks consensus state across block heights and rounds.
|
||||||
type ConsensusState struct {
|
type ConsensusState struct {
|
||||||
QuitService
|
BaseService
|
||||||
|
|
||||||
config cfg.Config
|
config cfg.Config
|
||||||
proxyAppConn proxy.AppConnConsensus
|
proxyAppConn proxy.AppConnConsensus
|
||||||
@ -255,7 +255,7 @@ func NewConsensusState(config cfg.Config, state *sm.State, proxyAppConn proxy.Ap
|
|||||||
// Don't call scheduleRound0 yet.
|
// Don't call scheduleRound0 yet.
|
||||||
// We do that upon Start().
|
// We do that upon Start().
|
||||||
cs.reconstructLastCommit(state)
|
cs.reconstructLastCommit(state)
|
||||||
cs.QuitService = *NewQuitService(log, "ConsensusState", cs)
|
cs.BaseService = *NewBaseService(log, "ConsensusState", cs)
|
||||||
return cs
|
return cs
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ func (cs *ConsensusState) SetPrivValidator(priv *types.PrivValidator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cs *ConsensusState) OnStart() error {
|
func (cs *ConsensusState) OnStart() error {
|
||||||
cs.QuitService.OnStart()
|
cs.BaseService.OnStart()
|
||||||
|
|
||||||
err := cs.OpenWAL(cs.config.GetString("cswal"))
|
err := cs.OpenWAL(cs.config.GetString("cswal"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -341,7 +341,7 @@ func (cs *ConsensusState) startRoutines(maxSteps int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cs *ConsensusState) OnStop() {
|
func (cs *ConsensusState) OnStop() {
|
||||||
cs.QuitService.OnStop()
|
cs.BaseService.OnStop()
|
||||||
|
|
||||||
if cs.wal != nil && cs.IsRunning() {
|
if cs.wal != nil && cs.IsRunning() {
|
||||||
cs.wal.Wait()
|
cs.wal.Wait()
|
||||||
|
8
glide.lock
generated
8
glide.lock
generated
@ -56,7 +56,7 @@ imports:
|
|||||||
- name: github.com/tendermint/go-clist
|
- name: github.com/tendermint/go-clist
|
||||||
version: 3baa390bbaf7634251c42ad69a8682e7e3990552
|
version: 3baa390bbaf7634251c42ad69a8682e7e3990552
|
||||||
- name: github.com/tendermint/go-common
|
- name: github.com/tendermint/go-common
|
||||||
version: 44f2818a3d6c0174da7c16c97387cb97fe6c63af
|
version: fa3daa7abc253264c916c12fecce3effa01a1287
|
||||||
subpackages:
|
subpackages:
|
||||||
- test
|
- test
|
||||||
- name: github.com/tendermint/go-config
|
- name: github.com/tendermint/go-config
|
||||||
@ -72,11 +72,11 @@ imports:
|
|||||||
- name: github.com/tendermint/go-merkle
|
- name: github.com/tendermint/go-merkle
|
||||||
version: 05042c6ab9cad51d12e4cecf717ae68e3b1409a8
|
version: 05042c6ab9cad51d12e4cecf717ae68e3b1409a8
|
||||||
- name: github.com/tendermint/go-p2p
|
- name: github.com/tendermint/go-p2p
|
||||||
version: 1eb390680d33299ba0e3334490eca587efd18414
|
version: 3e6deb4f9b2f5ea07e4ec5d57559d403291bf485
|
||||||
subpackages:
|
subpackages:
|
||||||
- upnp
|
- upnp
|
||||||
- name: github.com/tendermint/go-rpc
|
- name: github.com/tendermint/go-rpc
|
||||||
version: 855255d73eecd25097288be70f3fb208a5817d80
|
version: 161e36fd56c2f95ad133dd03ddb33db0363ca742
|
||||||
subpackages:
|
subpackages:
|
||||||
- client
|
- client
|
||||||
- server
|
- server
|
||||||
@ -88,7 +88,7 @@ imports:
|
|||||||
subpackages:
|
subpackages:
|
||||||
- term
|
- term
|
||||||
- name: github.com/tendermint/tmsp
|
- name: github.com/tendermint/tmsp
|
||||||
version: 5d3eb0328a615ba55b580ce871033e605aa8b97d
|
version: 940f46278380a8a76da310ec05e925ff05a42635
|
||||||
subpackages:
|
subpackages:
|
||||||
- client
|
- client
|
||||||
- example/counter
|
- example/counter
|
||||||
|
@ -21,7 +21,7 @@ func NewAppConns(config cfg.Config, clientCreator ClientCreator, state State, bl
|
|||||||
// a multiAppConn is made of a few appConns (mempool, consensus, query)
|
// a multiAppConn is made of a few appConns (mempool, consensus, query)
|
||||||
// and manages their underlying tmsp clients, ensuring they reboot together
|
// and manages their underlying tmsp clients, ensuring they reboot together
|
||||||
type multiAppConn struct {
|
type multiAppConn struct {
|
||||||
QuitService
|
BaseService
|
||||||
|
|
||||||
config cfg.Config
|
config cfg.Config
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ func NewMultiAppConn(config cfg.Config, clientCreator ClientCreator, state State
|
|||||||
blockStore: blockStore,
|
blockStore: blockStore,
|
||||||
clientCreator: clientCreator,
|
clientCreator: clientCreator,
|
||||||
}
|
}
|
||||||
multiAppConn.QuitService = *NewQuitService(log, "multiAppConn", multiAppConn)
|
multiAppConn.BaseService = *NewBaseService(log, "multiAppConn", multiAppConn)
|
||||||
return multiAppConn
|
return multiAppConn
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ func (app *multiAppConn) Query() AppConnQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (app *multiAppConn) OnStart() error {
|
func (app *multiAppConn) OnStart() error {
|
||||||
app.QuitService.OnStart()
|
app.BaseService.OnStart()
|
||||||
|
|
||||||
// query connection
|
// query connection
|
||||||
querycli, err := app.clientCreator.NewTMSPClient()
|
querycli, err := app.clientCreator.NewTMSPClient()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user