Commit a00052d2 authored by suyanlong's avatar suyanlong

Fix panic bug

parent 1ccbb26f
Pipeline #8410 failed with stages
......@@ -49,17 +49,15 @@ func New(config *repo.Config, router router.Router, nodePrivKey crypto.PrivateKe
if err != nil {
return nil, fmt.Errorf("convert private key: %w", err)
}
var ll string
var remotes map[string]*peer.AddrInfo
id, err := peer.IDFromPrivateKey(libp2pPrivKey)
if err != nil {
panic(err)
return nil, err
}
local := newLocal(id, privKey)
ll, remotes, err = loadPeers(config.Peer.Peers, libp2pPrivKey)
ll, remotes, err := loadPeers(config.Peer.Peers, libp2pPrivKey)
if err != nil {
return nil, fmt.Errorf("load peers: %w", err)
}
......@@ -246,11 +244,7 @@ func (swarm *Swarm) Stop() error {
return err
}
swarm.cancel()
err := swarm.router.Stop()
if err != nil {
return err
}
return nil
return swarm.router.Stop()
}
func (swarm *Swarm) Connect(addrInfo *peer.AddrInfo) (string, error) {
......
......@@ -21,8 +21,8 @@ func NewPortMap() *PortMap {
rw: sync.RWMutex{},
peerPort: map[string]Port{},
appchainPort: map[string]Port{},
hubPort: nil,
local: nil,
hubPort: nil, //TODO
local: nil, //TODO
}
}
......
......@@ -21,11 +21,6 @@ type Router interface {
Send(id string, msg *pb.Message) (*pb.Message, error)
AsyncSend(id string, msg *pb.Message) error
// InPut(ibtp *pb.IBTP) chan *pb.IBTP
// OutPut(ibtp *pb.IBTP) chan *pb.IBTP
// 代替上面两个方法
// Router(ibtp *pb.IBTP) chan *pb.IBTP
}
// 路由规则,根据路由表,rules接口, 这个放到交易内部。可以让用户决定。并且签名。
......
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