Commit 522ebba0 authored by suyanlong's avatar suyanlong

Adjust start flow

parent 99fb481c
Pipeline #8394 failed with stages
......@@ -59,16 +59,17 @@ func NewSidecar(repoRoot string, config *repo.Config) (internal.Launcher, error)
r := router.NewRouter(privateKey, loggers.Logger(loggers.Router))
pm, err := peermgr.New(config, r, nodePrivKey, privateKey, 1, loggers.Logger(loggers.PeerMgr))
tool.Asset(err)
clients := plugins.CreateClients(config.Appchains, nil)
persister := manager.NewPersister(addr.String(), store, loggers.Logger(loggers.Manager))
appchainMgr := appchainmgr.New(persister)
rule := rulemgr.New(store, loggers.Logger(loggers.RuleMgr))
mg, err := manager.NewManager(addr.String(), pm, appchainMgr, rule, loggers.Logger(loggers.Manager))
clients := plugins.CreateClients(config.Appchains, nil)
// TODO hub client
// privateKey DH
cryptor := txcrypto.NewCryptor(nil, appchainMgr, privateKey)
managerPort := appchain.NewManager(clients, cryptor, logger)
r.Adds(managerPort.Ports())
rule := rulemgr.New(store, loggers.Logger(loggers.RuleMgr))
mg, err := manager.NewManager(addr.String(), pm, appchainMgr, rule, loggers.Logger(loggers.Manager))
tool.Asset(err)
apiServer := api.NewServer(config, r, loggers.Logger(loggers.ApiServer))
ctx, cancel := context.WithCancel(context.Background())
......@@ -86,7 +87,7 @@ func NewSidecar(repoRoot string, config *repo.Config) (internal.Launcher, error)
// Start starts three main components of sidecar app
func (s *App) Start() error {
if err := s.apiServer.Start(); err != nil {
if err := s.manger.Start(); err != nil {
return err
}
......@@ -94,7 +95,7 @@ func (s *App) Start() error {
return err
}
return s.manger.Start()
return s.apiServer.Start()
}
// Stop stops three main components of sidecar app
......
......@@ -51,7 +51,7 @@ func (l *localPeer) Tag() string {
return l.tag
}
// 需要同步处理的数据,主要用于处理接收的其它sidecar port 、外部API返回数据。
// Send 需要同步处理的数据,主要用于处理接收的其它sidecar port 、外部API返回数据。
func (l *localPeer) Send(msg *pb.Message) (*pb.Message, error) {
// 同步完成
switch msg.Type {
......@@ -64,7 +64,7 @@ func (l *localPeer) Send(msg *pb.Message) (*pb.Message, error) {
return nil, nil
}
// 需要异步处理的数据
// AsyncSend 需要异步处理的数据
func (l *localPeer) AsyncSend(msg *pb.Message) error {
// 先获取消息类型,做出判断是否路由,判断是异步还是同步。
// 然后做出IBTPX消息,对from、to做路由判断,以及同步异步完成。
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment