Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340532
b: refs/heads/master
c: fe3f4cf
h: refs/heads/master
v: v3
  • Loading branch information
Sven Eckelmann authored and Antonio Quartulli committed Oct 29, 2012
1 parent 0042a9a commit c64f8cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bd5b80d51a6c4a68f7d4b9b92c495329f47e53d4
refs/heads/master: fe3f4cfe8ef8b4f0979a0dd61f60de832848664a
23 changes: 8 additions & 15 deletions trunk/net/batman-adv/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,25 +549,18 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig,
if (tmp_neigh_node->if_incoming == recv_if)
continue;

if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))
if (router && tmp_neigh_node->tq_avg <= router->tq_avg)
continue;

/* if we don't have a router yet
* or this one is better, choose it.
*/
if ((!router) ||
(tmp_neigh_node->tq_avg > router->tq_avg)) {
/* decrement refcount of
* previously selected router
*/
if (router)
batadv_neigh_node_free_ref(router);
if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))
continue;

router = tmp_neigh_node;
atomic_inc_not_zero(&router->refcount);
}
/* decrement refcount of previously selected router */
if (router)
batadv_neigh_node_free_ref(router);

batadv_neigh_node_free_ref(tmp_neigh_node);
/* we found a better router (or at least one valid router) */
router = tmp_neigh_node;
}

/* use the first candidate if nothing was found. */
Expand Down

0 comments on commit c64f8cf

Please sign in to comment.