Keep track of configured peer count correctly on dynamic reloads

This commit is contained in:
Matthias Schiffer 2012-11-10 15:20:39 +01:00
parent 13c71785b5
commit 6ef24092b5
2 changed files with 3 additions and 3 deletions

View file

@ -598,10 +598,8 @@ static void init_peers(fastd_context *ctx) {
for (peer_conf = ctx->conf->peers; peer_conf; peer_conf = peer_conf->next) { for (peer_conf = ctx->conf->peers; peer_conf; peer_conf = peer_conf->next) {
ctx->conf->protocol->peer_configure(ctx, peer_conf); ctx->conf->protocol->peer_configure(ctx, peer_conf);
if (peer_conf->enabled) { if (peer_conf->enabled)
fastd_peer_add(ctx, peer_conf); fastd_peer_add(ctx, peer_conf);
ctx->n_peers++;
}
} }
} }

View file

@ -288,6 +288,7 @@ static void delete_peer(fastd_context *ctx, fastd_peer *peer) {
ctx->conf->protocol->free_peer_state(ctx, peer); ctx->conf->protocol->free_peer_state(ctx, peer);
free(peer); free(peer);
ctx->n_peers--;
} }
@ -474,6 +475,7 @@ fastd_peer* fastd_peer_add(fastd_context *ctx, fastd_peer_config *peer_conf) {
setup_peer(ctx, peer); setup_peer(ctx, peer);
pr_verbose(ctx, "adding peer %P (group `%s')", peer, peer->group->conf->name); pr_verbose(ctx, "adding peer %P (group `%s')", peer, peer->group->conf->name);
ctx->n_peers++;
return peer; return peer;
} }