proxy: remove Handshaker from proxy pkg (#2437)

Handshaker was removed from proxy package so it can be called
independently of starting the abci app connections and can return a
result to the caller.
This commit is contained in:
Ethan Buchman
2018-09-19 09:35:09 -04:00
committed by Alexander Simmerl
parent 3e099f75c7
commit 91a8767083
6 changed files with 38 additions and 36 deletions

View File

@ -17,26 +17,19 @@ type AppConns interface {
Query() AppConnQuery
}
func NewAppConns(clientCreator ClientCreator, handshaker Handshaker) AppConns {
return NewMultiAppConn(clientCreator, handshaker)
func NewAppConns(clientCreator ClientCreator) AppConns {
return NewMultiAppConn(clientCreator)
}
//-----------------------------
// multiAppConn implements AppConns
type Handshaker interface {
Handshake(AppConns) error
}
// a multiAppConn is made of a few appConns (mempool, consensus, query)
// and manages their underlying abci clients, including the handshake
// which ensures the app and tendermint are synced.
// and manages their underlying abci clients
// TODO: on app restart, clients must reboot together
type multiAppConn struct {
cmn.BaseService
handshaker Handshaker
mempoolConn *appConnMempool
consensusConn *appConnConsensus
queryConn *appConnQuery
@ -45,9 +38,8 @@ type multiAppConn struct {
}
// Make all necessary abci connections to the application
func NewMultiAppConn(clientCreator ClientCreator, handshaker Handshaker) *multiAppConn {
func NewMultiAppConn(clientCreator ClientCreator) *multiAppConn {
multiAppConn := &multiAppConn{
handshaker: handshaker,
clientCreator: clientCreator,
}
multiAppConn.BaseService = *cmn.NewBaseService(nil, "multiAppConn", multiAppConn)
@ -103,10 +95,5 @@ func (app *multiAppConn) OnStart() error {
}
app.consensusConn = NewAppConnConsensus(concli)
// ensure app is synced to the latest state
if app.handshaker != nil {
return app.handshaker.Handshake(app)
}
return nil
}