Code consistency. Small bug fix.

This commit is contained in:
Milos Gajdos 2020-01-16 17:04:04 +00:00
parent 60c05bd899
commit 472186c1be
No known key found for this signature in database
GPG Key ID: 8B31058CC55DFD4F

View File

@ -854,7 +854,7 @@ func (n *network) processNetChan(listener tunnel.Listener) {
q := []router.QueryOption{ q := []router.QueryOption{
router.QueryStrategy(n.router.Options().Advertise), router.QueryStrategy(n.router.Options().Advertise),
} }
routes, err := n.options.Router.Table().Query(q...) routes, err := n.router.Table().Query(q...)
switch err { switch err {
case nil: case nil:
// encode the routes to protobuf // encode the routes to protobuf
@ -1051,7 +1051,7 @@ func (n *network) processNetChan(listener tunnel.Listener) {
// unmarshal the routes received from remote peer // unmarshal the routes received from remote peer
route := pbUtil.ProtoToRoute(pbRoute) route := pbUtil.ProtoToRoute(pbRoute)
// continue if we are the originator of the route // continue if we are the originator of the route
if route.Router == n.options.Router.Options().Id { if route.Router == n.router.Options().Id {
log.Debugf("Network node %s skipping route addition: route already present", n.id) log.Debugf("Network node %s skipping route addition: route already present", n.id)
continue continue
} }
@ -1061,7 +1061,7 @@ func (n *network) processNetChan(listener tunnel.Listener) {
router.QueryStrategy(n.router.Options().Advertise), router.QueryStrategy(n.router.Options().Advertise),
} }
routes, err := n.options.Router.Table().Query(q...) routes, err := n.router.Table().Query(q...)
if err != nil { if err != nil {
log.Debugf("Network node %s failed listing best routes for %s: %v", n.id, route.Service, err) log.Debugf("Network node %s failed listing best routes for %s: %v", n.id, route.Service, err)
continue continue
@ -1075,6 +1075,7 @@ func (n *network) processNetChan(listener tunnel.Listener) {
log.Debugf("Network node %s failed to add route: %v", n.id, err) log.Debugf("Network node %s failed to add route: %v", n.id, err)
continue continue
} }
continue
} }
// find the best route for the given service // find the best route for the given service
@ -1381,7 +1382,7 @@ func (n *network) manage() {
q := []router.QueryOption{ q := []router.QueryOption{
router.QueryStrategy(n.router.Options().Advertise), router.QueryStrategy(n.router.Options().Advertise),
} }
routes, err := n.options.Router.Table().Query(q...) routes, err := n.router.Table().Query(q...)
switch err { switch err {
case nil: case nil:
// encode the routes to protobuf // encode the routes to protobuf