1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00

Send connect message to NetworkChannel once we are not at caller mercy

This commit is contained in:
Milos Gajdos 2019-09-03 19:51:52 +01:00
parent 6c21b31226
commit 4f4b3d3bae
No known key found for this signature in database
GPG Key ID: 8B31058CC55DFD4F

View File

@ -764,23 +764,10 @@ func (n *network) Connect() error {
return err
}
// go resolving network nodes
go n.resolve()
// broadcast neighbourhood
go n.announce(netClient)
// prune stale nodes
go n.prune()
// listen to network messages
go n.processNetChan(netListener)
// advertise service routes
go n.advertise(ctrlClient, advertChan)
// accept and process routes
go n.processCtrlChan(ctrlListener)
// set connected to true
n.connected = true
// send connect message to NetworkChannel
// NOTE: in theory we could do this as soon as
// Dial to NetworkChannel succeeds, but instead
// we initialize all other node resources first
node := &pbNet.Node{
Id: n.options.Id,
Address: n.options.Address,
@ -803,6 +790,22 @@ func (n *network) Connect() error {
}
}
// go resolving network nodes
go n.resolve()
// broadcast neighbourhood
go n.announce(netClient)
// prune stale nodes
go n.prune()
// listen to network messages
go n.processNetChan(netListener)
// advertise service routes
go n.advertise(ctrlClient, advertChan)
// accept and process routes
go n.processCtrlChan(ctrlListener)
// set connected to true
n.connected = true
return nil
}