Remove redundant connection_t::status.active field.

The only places where connection_t::status.active is modified is in
ack_h() and terminate_connection(). In both cases, connection_t::edge
is added and removed at the same time, and that's the only places
connection_t::edge is set. Therefore, the following is true at all
times:

    !c->status.active == !c->edge

This commit removes the redundant state information by getting rid of
connection_t::status.active, and using connection_t::edge instead.
This commit is contained in:
Etienne Dechamps 2014-07-12 11:57:03 +01:00 committed by Guus Sliepen
parent 127f2f99f3
commit b23bf13283
9 changed files with 15 additions and 19 deletions

View file

@ -203,7 +203,7 @@ static void age_subnets(void *data) {
}
for list_each(connection_t, c, connection_list)
if(c->status.active)
if(c->edge)
send_del_subnet(c, s);
subnet_del(myself, s);
@ -238,7 +238,7 @@ static void learn_mac(mac_t *address) {
/* And tell all other tinc daemons it's our MAC */
for list_each(connection_t, c, connection_list)
if(c->status.active)
if(c->edge)
send_add_subnet(c, subnet);
timeout_add(&age_subnets_timeout, age_subnets, NULL, &(struct timeval){10, rand() % 100000});