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

Fixed typos and simplified map iteration

This commit is contained in:
Milos Gajdos 2019-09-05 17:59:14 +01:00
parent ec354934e3
commit dddfb6f878
No known key found for this signature in database
GPG Key ID: 8B31058CC55DFD4F
2 changed files with 4 additions and 4 deletions

View File

@ -377,7 +377,7 @@ func (n *network) processNetChan(client transport.Client, listener tunnel.Listen
}
n.Unlock()
// send a solicit message when discovering a new node
// NOTE: we need to send the solicit message here after the Lock is released as sendMsg locs
// NOTE: we need to send the solicit message here after the Lock is released as sendMsg locks, too
if !exists {
if err := n.sendMsg("solicit", NetworkChannel); err != nil {
log.Debugf("Network failed to send solicit message: %s", err)
@ -433,7 +433,7 @@ func (n *network) sendMsg(msgType string, channel string) error {
n.RLock()
nodes := make([]*pbNet.Node, len(n.neighbours))
i := 0
for id, _ := range n.neighbours {
for id := range n.neighbours {
nodes[i] = &pbNet.Node{
Id: id,
Address: n.neighbours[id].address,
@ -609,7 +609,7 @@ func (n *network) setRouteMetric(route *router.Route) {
// check if the route origin is the neighbour of our neighbour
for _, node := range n.neighbours {
for id, _ := range node.neighbours {
for id := range node.neighbours {
if route.Router == id {
route.Metric = 100
n.RUnlock()

View File

@ -28,7 +28,7 @@ type Router interface {
Advertise() (<-chan *Advert, error)
// Process processes incoming adverts
Process(*Advert) error
// Solicit advertises the whole routing table ot the network
// Solicit advertises the whole routing table to the network
Solicit() error
// Lookup queries routes in the routing table
Lookup(Query) ([]Route, error)