Commit 1ccbb26f authored by suyanlong's avatar suyanlong

Fix newSidecar function return value

parent ebd26f9a
......@@ -160,13 +160,15 @@ func (swarm *Swarm) Start() error {
"node": remoteID,
"address:": address,
}).Info("Connect successfully")
//swarm.lock.RLock()
//defer swarm.lock.RUnlock()
//for _, handler := range swarm.connectHandlers {
// go func(connectHandler ConnectHandler, address string) {
// connectHandler(address)
// }(handler, address)
//}
{
//swarm.lock.RLock()
//defer swarm.lock.RUnlock()
//for _, handler := range swarm.connectHandlers {
// go func(connectHandler ConnectHandler, address string) {
// connectHandler(address)
// }(handler, address)
//}
}
wg.Done()
}(id, addr)
}
......@@ -198,7 +200,6 @@ func (swarm *Swarm) handleMessage(s network.Stream, data []byte) {
}
msgHandlerPort, ok := handler.(MessageHandlerPort)
if ok {
msgHandlerPort(func() port.Port { return swarm.newSidecar(s.RemotePeerID()) }, m)
return
}
......@@ -212,6 +213,7 @@ func (swarm *Swarm) newSidecar(sidecarID string) *sidecar {
info, err := swarm.getRemotePeerInfo(sidecarID)
if err != nil {
swarm.logger.Error(err)
return nil
}
p := newSidecar(sidecarID, info.GetTag(), swarm)
return p
......@@ -228,9 +230,6 @@ func (swarm *Swarm) handleIBTPX(fn func() port.Port, m *pb.Message) {
ps.Receive(m)
}
} else {
//ppt := pt.(*sidecar)
//swarm.addRemotePort(ppt)
//ppt.Receive(m)
swarm.logger.WithFields(logrus.Fields{
"remote port": pt.ID(),
"func": "Swarm.handleIBTPX",
......
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