summaryrefslogtreecommitdiffstats
path: root/src/fastd.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-03-08 20:25:17 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-03-08 20:25:17 +0100
commit11f1c9adcaeb4077c4fdab120eb6197795a2a872 (patch)
treec4425f7175e6374cd089fddf79bf9f614f301f16 /src/fastd.c
parent4e9b2a8819c7062ad052cd6c549db1d0fbed001d (diff)
downloadfastd-11f1c9adcaeb4077c4fdab120eb6197795a2a872.tar
fastd-11f1c9adcaeb4077c4fdab120eb6197795a2a872.zip
Allow disabling previously enabled peers
Diffstat (limited to 'src/fastd.c')
-rw-r--r--src/fastd.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/fastd.c b/src/fastd.c
index fec0838..59a99ab 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -616,15 +616,24 @@ static void delete_peer_groups(fastd_context_t *ctx) {
static void init_peers(fastd_context_t *ctx) {
fastd_peer_config_t *peer_conf;
for (peer_conf = ctx->conf->peers; peer_conf; peer_conf = peer_conf->next) {
- if (peer_conf->enabled)
- continue;
+ bool was_enabled = peer_conf->enabled;
peer_conf->enabled = true;
ctx->conf->protocol->peer_configure(ctx, peer_conf);
- if (peer_conf->enabled)
+ if (peer_conf->enabled && !was_enabled)
fastd_peer_add(ctx, peer_conf);
}
+
+ fastd_peer_t *peer, *next;
+ for (peer = ctx->peers; peer; peer = next) {
+ next = peer->next;
+
+ if (!peer->config->enabled) {
+ pr_info(ctx, "previously enabled peer %P disabled, deleting.", peer);
+ fastd_peer_delete(ctx, peer);
+ }
+ }
}
static void delete_peers(fastd_context_t *ctx) {