Browse Source

QuitService->BaseService

pull/310/head
Jae Kwon 8 years ago
parent
commit
480f44f16c
5 changed files with 19 additions and 19 deletions
  1. +7
    -7
      blockchain/pool.go
  2. +1
    -1
      consensus/reactor.go
  3. +4
    -4
      consensus/state.go
  4. +4
    -4
      glide.lock
  5. +3
    -3
      proxy/multi_app_conn.go

+ 7
- 7
blockchain/pool.go View File

@ -32,7 +32,7 @@ var peerTimeoutSeconds = time.Duration(15) // not const so we can override with
*/
type BlockPool struct {
QuitService
BaseService
startTime time.Time
mtx sync.Mutex
@ -58,19 +58,19 @@ func NewBlockPool(start int, requestsCh chan<- BlockRequest, timeoutsCh chan<- s
requestsCh: requestsCh,
timeoutsCh: timeoutsCh,
}
bp.QuitService = *NewQuitService(log, "BlockPool", bp)
bp.BaseService = *NewBaseService(log, "BlockPool", bp)
return bp
}
func (pool *BlockPool) OnStart() error {
pool.QuitService.OnStart()
pool.BaseService.OnStart()
go pool.makeRequestersRoutine()
pool.startTime = time.Now()
return nil
}
func (pool *BlockPool) OnStop() {
pool.QuitService.OnStop()
pool.BaseService.OnStop()
}
// Run spawns requesters as needed.
@ -383,7 +383,7 @@ func (peer *bpPeer) onTimeout() {
//-------------------------------------
type bpRequester struct {
QuitService
BaseService
pool *BlockPool
height int
gotBlockCh chan struct{}
@ -404,12 +404,12 @@ func newBPRequester(pool *BlockPool, height int) *bpRequester {
peerID: "",
block: nil,
}
bpr.QuitService = *NewQuitService(nil, "bpRequester", bpr)
bpr.BaseService = *NewBaseService(nil, "bpRequester", bpr)
return bpr
}
func (bpr *bpRequester) OnStart() error {
bpr.QuitService.OnStart()
bpr.BaseService.OnStart()
go bpr.requestRoutine()
return nil
}


+ 1
- 1
consensus/reactor.go View File

@ -28,7 +28,7 @@ const (
//-----------------------------------------------------------------------------
type ConsensusReactor struct {
p2p.BaseReactor // QuitService + p2p.Switch
p2p.BaseReactor // BaseService + p2p.Switch
blockStore *bc.BlockStore
conS *ConsensusState


+ 4
- 4
consensus/state.go View File

@ -211,7 +211,7 @@ func (ti *timeoutInfo) String() string {
// Tracks consensus state across block heights and rounds.
type ConsensusState struct {
QuitService
BaseService
config cfg.Config
proxyAppConn proxy.AppConnConsensus
@ -255,7 +255,7 @@ func NewConsensusState(config cfg.Config, state *sm.State, proxyAppConn proxy.Ap
// Don't call scheduleRound0 yet.
// We do that upon Start().
cs.reconstructLastCommit(state)
cs.QuitService = *NewQuitService(log, "ConsensusState", cs)
cs.BaseService = *NewBaseService(log, "ConsensusState", cs)
return cs
}
@ -302,7 +302,7 @@ func (cs *ConsensusState) SetPrivValidator(priv *types.PrivValidator) {
}
func (cs *ConsensusState) OnStart() error {
cs.QuitService.OnStart()
cs.BaseService.OnStart()
err := cs.OpenWAL(cs.config.GetString("cswal"))
if err != nil {
@ -341,7 +341,7 @@ func (cs *ConsensusState) startRoutines(maxSteps int) {
}
func (cs *ConsensusState) OnStop() {
cs.QuitService.OnStop()
cs.BaseService.OnStop()
if cs.wal != nil && cs.IsRunning() {
cs.wal.Wait()


+ 4
- 4
glide.lock View File

@ -56,7 +56,7 @@ imports:
- name: github.com/tendermint/go-clist
version: 3baa390bbaf7634251c42ad69a8682e7e3990552
- name: github.com/tendermint/go-common
version: 44f2818a3d6c0174da7c16c97387cb97fe6c63af
version: fa3daa7abc253264c916c12fecce3effa01a1287
subpackages:
- test
- name: github.com/tendermint/go-config
@ -72,11 +72,11 @@ imports:
- name: github.com/tendermint/go-merkle
version: 05042c6ab9cad51d12e4cecf717ae68e3b1409a8
- name: github.com/tendermint/go-p2p
version: 1eb390680d33299ba0e3334490eca587efd18414
version: 3e6deb4f9b2f5ea07e4ec5d57559d403291bf485
subpackages:
- upnp
- name: github.com/tendermint/go-rpc
version: 855255d73eecd25097288be70f3fb208a5817d80
version: 161e36fd56c2f95ad133dd03ddb33db0363ca742
subpackages:
- client
- server
@ -88,7 +88,7 @@ imports:
subpackages:
- term
- name: github.com/tendermint/tmsp
version: 5d3eb0328a615ba55b580ce871033e605aa8b97d
version: 940f46278380a8a76da310ec05e925ff05a42635
subpackages:
- client
- example/counter


+ 3
- 3
proxy/multi_app_conn.go View File

@ -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)
// and manages their underlying tmsp clients, ensuring they reboot together
type multiAppConn struct {
QuitService
BaseService
config cfg.Config
@ -43,7 +43,7 @@ func NewMultiAppConn(config cfg.Config, clientCreator ClientCreator, state State
blockStore: blockStore,
clientCreator: clientCreator,
}
multiAppConn.QuitService = *NewQuitService(log, "multiAppConn", multiAppConn)
multiAppConn.BaseService = *NewBaseService(log, "multiAppConn", multiAppConn)
return multiAppConn
}
@ -62,7 +62,7 @@ func (app *multiAppConn) Query() AppConnQuery {
}
func (app *multiAppConn) OnStart() error {
app.QuitService.OnStart()
app.BaseService.OnStart()
// query connection
querycli, err := app.clientCreator.NewTMSPClient()


Loading…
Cancel
Save