Commit 51101a7c authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Rename neighbour_cost to rxcost and symmetric_cost to cost.

parent 1cb3f767
...@@ -437,11 +437,11 @@ main(int argc, char **argv) ...@@ -437,11 +437,11 @@ main(int argc, char **argv)
if(neighs[i].id[0] == 0) if(neighs[i].id[0] == 0)
continue; continue;
printf("Neighbour %s ", format_address(neighs[i].id)); printf("Neighbour %s ", format_address(neighs[i].id));
printf("at %s dev %s reach %04x cost %d txcost %d.\n", printf("at %s dev %s reach %04x rxcost %d txcost %d.\n",
format_address(neighs[i].address), format_address(neighs[i].address),
neighs[i].network->ifname, neighs[i].network->ifname,
neighs[i].reach, neighs[i].reach,
neighbour_cost(&neighs[i]), neighbour_rxcost(&neighs[i]),
neighs[i].txcost); neighs[i].txcost);
} }
for(i = 0; i < numroutes; i++) { for(i = 0; i < numroutes; i++) {
......
...@@ -546,8 +546,6 @@ send_txcost(struct neighbour *neigh, struct network *net) ...@@ -546,8 +546,6 @@ send_txcost(struct neighbour *neigh, struct network *net)
} }
net->txcost_time = now.tv_sec; net->txcost_time = now.tv_sec;
} else { } else {
int cost;
if(net && neigh->network != net) if(net && neigh->network != net)
return; return;
...@@ -558,12 +556,10 @@ send_txcost(struct neighbour *neigh, struct network *net) ...@@ -558,12 +556,10 @@ send_txcost(struct neighbour *neigh, struct network *net)
format_address(neigh->id), format_address(neigh->id),
format_address(neigh->address)); format_address(neigh->address));
cost = neighbour_cost(neigh);
start_message(net, 20); start_message(net, 20);
accumulate_byte(net, 3); accumulate_byte(net, 3);
accumulate_byte(net, 0); accumulate_byte(net, 0);
accumulate_short(net, neighbour_cost(neigh)); accumulate_short(net, neighbour_rxcost(neigh));
accumulate_data(net, neigh->id, 16); accumulate_data(net, neigh->id, 16);
schedule_flush(net); schedule_flush(net);
} }
......
...@@ -190,7 +190,7 @@ check_neighbour(struct neighbour *neigh) ...@@ -190,7 +190,7 @@ check_neighbour(struct neighbour *neigh)
} }
int int
neighbour_cost(struct neighbour *neigh) neighbour_rxcost(struct neighbour *neigh)
{ {
update_neighbour(neigh, -1, 0); update_neighbour(neigh, -1, 0);
if(neigh->reach == 0) if(neigh->reach == 0)
...@@ -215,7 +215,7 @@ neighbour_cost(struct neighbour *neigh) ...@@ -215,7 +215,7 @@ neighbour_cost(struct neighbour *neigh)
} }
int int
neighbour_symmetric_cost(struct neighbour *neigh) neighbour_cost(struct neighbour *neigh)
{ {
int c; int c;
/* (1/(alpha * beta) + 1/beta) / 2, which is half the expected /* (1/(alpha * beta) + 1/beta) / 2, which is half the expected
...@@ -226,7 +226,7 @@ neighbour_symmetric_cost(struct neighbour *neigh) ...@@ -226,7 +226,7 @@ neighbour_symmetric_cost(struct neighbour *neigh)
if(neigh->txcost >= INFINITY) if(neigh->txcost >= INFINITY)
return INFINITY; return INFINITY;
c = neighbour_cost(neigh); c = neighbour_rxcost(neigh);
if(c >= INFINITY) if(c >= INFINITY)
return INFINITY; return INFINITY;
......
...@@ -43,5 +43,5 @@ add_neighbour(const unsigned char *id, const unsigned char *address, ...@@ -43,5 +43,5 @@ add_neighbour(const unsigned char *id, const unsigned char *address,
struct network *net); struct network *net);
void update_neighbour(struct neighbour *neigh, int hello, int hello_interval); void update_neighbour(struct neighbour *neigh, int hello, int hello_interval);
void check_neighbour(struct neighbour *neigh); void check_neighbour(struct neighbour *neigh);
int neighbour_rxcost(struct neighbour *neigh);
int neighbour_cost(struct neighbour *neigh); int neighbour_cost(struct neighbour *neigh);
int neighbour_symmetric_cost(struct neighbour *neigh);
...@@ -284,7 +284,7 @@ void ...@@ -284,7 +284,7 @@ void
update_route_metric(struct route *route) update_route_metric(struct route *route)
{ {
int metric, oldmetric, install = 0; int metric, oldmetric, install = 0;
metric = MIN(route->refmetric + neighbour_symmetric_cost(route->nexthop), metric = MIN(route->refmetric + neighbour_cost(route->nexthop),
INFINITY); INFINITY);
if(route->installed && if(route->installed &&
(metric >= INFINITY || (metric >= INFINITY ||
...@@ -328,7 +328,7 @@ update_route(const unsigned char *d, int seqno, int refmetric, ...@@ -328,7 +328,7 @@ update_route(const unsigned char *d, int seqno, int refmetric,
if(dest == NULL) if(dest == NULL)
return NULL; return NULL;
metric = MIN(refmetric + neighbour_symmetric_cost(nexthop), INFINITY); metric = MIN(refmetric + neighbour_cost(nexthop), INFINITY);
route = find_route(d, nexthop); route = find_route(d, nexthop);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment