From dddfb6f878a0856aba3fd22b91943ebe49fb3655 Mon Sep 17 00:00:00 2001 From: Milos Gajdos Date: Thu, 5 Sep 2019 17:59:14 +0100 Subject: [PATCH] Fixed typos and simplified map iteration --- network/default.go | 6 +++--- router/router.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/network/default.go b/network/default.go index e0123c3f..674bba3c 100644 --- a/network/default.go +++ b/network/default.go @@ -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() diff --git a/router/router.go b/router/router.go index 224ef124..3e8f00cd 100644 --- a/router/router.go +++ b/router/router.go @@ -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)