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

@ -388,7 +388,7 @@ static void handle_meta_write(connection_t *c) {
logger(DEBUG_CONNECTIONS, LOG_ERR, "Could not send %d bytes of data to %s (%s): %s", c->outbuf.len - c->outbuf.offset, c->name, c->hostname, sockstrerror(sockerrno));
}
terminate_connection(c, c->status.active);
terminate_connection(c, c->edge);
return;
}
@ -820,7 +820,7 @@ void try_outgoing_connections(void) {
if(c->outgoing && c->outgoing->timeout == -1) {
c->outgoing = NULL;
logger(DEBUG_CONNECTIONS, LOG_INFO, "No more outgoing connection to %s", c->name);
terminate_connection(c, c->status.active);
terminate_connection(c, c->edge);
}
}