mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-27 03:31:42 +00:00
QuitService->BaseService
This commit is contained in:
@ -75,7 +75,7 @@ const (
|
|||||||
|
|
||||||
/* AddrBook - concurrency safe peer address manager */
|
/* AddrBook - concurrency safe peer address manager */
|
||||||
type AddrBook struct {
|
type AddrBook struct {
|
||||||
QuitService
|
BaseService
|
||||||
|
|
||||||
mtx sync.Mutex
|
mtx sync.Mutex
|
||||||
filePath string
|
filePath string
|
||||||
@ -106,7 +106,7 @@ func NewAddrBook(filePath string, routabilityStrict bool) *AddrBook {
|
|||||||
routabilityStrict: routabilityStrict,
|
routabilityStrict: routabilityStrict,
|
||||||
}
|
}
|
||||||
am.init()
|
am.init()
|
||||||
am.QuitService = *NewQuitService(log, "AddrBook", am)
|
am.BaseService = *NewBaseService(log, "AddrBook", am)
|
||||||
return am
|
return am
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ func (a *AddrBook) init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *AddrBook) OnStart() error {
|
func (a *AddrBook) OnStart() error {
|
||||||
a.QuitService.OnStart()
|
a.BaseService.OnStart()
|
||||||
a.loadFromFile(a.filePath)
|
a.loadFromFile(a.filePath)
|
||||||
a.wg.Add(1)
|
a.wg.Add(1)
|
||||||
go a.saveRoutine()
|
go a.saveRoutine()
|
||||||
@ -134,7 +134,7 @@ func (a *AddrBook) OnStart() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *AddrBook) OnStop() {
|
func (a *AddrBook) OnStop() {
|
||||||
a.QuitService.OnStop()
|
a.BaseService.OnStop()
|
||||||
a.wg.Wait()
|
a.wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ type Reactor interface {
|
|||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
|
|
||||||
type BaseReactor struct {
|
type BaseReactor struct {
|
||||||
QuitService // Provides Start, Stop, .Quit
|
BaseService // Provides Start, Stop, .Quit
|
||||||
Switch *Switch
|
Switch *Switch
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBaseReactor(log log15.Logger, name string, impl Reactor) *BaseReactor {
|
func NewBaseReactor(log log15.Logger, name string, impl Reactor) *BaseReactor {
|
||||||
return &BaseReactor{
|
return &BaseReactor{
|
||||||
QuitService: *NewQuitService(log, name, impl),
|
BaseService: *NewBaseService(log, name, impl),
|
||||||
Switch: nil,
|
Switch: nil,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user