Commit 464c1e86 authored by Julien Cristau's avatar Julien Cristau

Don't call neighbour_rxcost() in the middle of a message

neighbour_rxcost() calls update_neighbour which might send some messages,
so make sure we don't call it in the middle of the txcost message.
parent 771607a8
......@@ -727,6 +727,8 @@ send_txcost(struct neighbour *neigh, struct network *net)
}
net->txcost_time = now.tv_sec;
} else {
int rxcost;
if(net && neigh->network != net)
return;
......@@ -737,10 +739,11 @@ send_txcost(struct neighbour *neigh, struct network *net)
format_address(neigh->id),
format_address(neigh->address));
rxcost = neighbour_rxcost(neigh);
start_message(net, 20);
accumulate_byte(net, 3);
accumulate_byte(net, 0);
accumulate_short(net, neighbour_rxcost(neigh));
accumulate_short(net, rxcost);
accumulate_data(net, neigh->id, 16);
schedule_flush(net);
}
......
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