summaryrefslogtreecommitdiffstats
path: root/src/peer.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-04-05 13:17:02 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-04-05 13:17:02 +0200
commit7b2cfb422af6a957aa90e22bd6e9b19f16b30319 (patch)
treeaaa2fd85662309af45ab4fced6b332445bdf0f10 /src/peer.c
parent329d15d50c54a69ce8e2be0865124744c0bf3428 (diff)
downloadfastd-7b2cfb422af6a957aa90e22bd6e9b19f16b30319.tar
fastd-7b2cfb422af6a957aa90e22bd6e9b19f16b30319.zip
Cleanly shutdown; add on-down command
Diffstat (limited to 'src/peer.c')
-rw-r--r--src/peer.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/peer.c b/src/peer.c
index 9bb900b..3566cfc 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -113,11 +113,8 @@ void fastd_peer_config_purge(fastd_context *ctx, fastd_peer_config *conf) {
for (peer = ctx->peers; peer; peer = next) {
next = peer->next;
- if (peer->config == conf) {
- reset_peer(ctx, peer);
- delete_peer(ctx, peer);
- continue;
- }
+ if (peer->config == conf)
+ fastd_peer_delete(ctx, peer);
}
ctx->conf->protocol->peer_config_purged(ctx, conf);
@@ -169,6 +166,11 @@ void fastd_peer_reset(fastd_context *ctx, fastd_peer *peer) {
setup_peer(ctx, peer);
}
+void fastd_peer_delete(fastd_context *ctx, fastd_peer *peer) {
+ reset_peer(ctx, peer);
+ delete_peer(ctx, peer);
+}
+
static fastd_peer* add_peer(fastd_context *ctx) {
fastd_peer *peer = malloc(sizeof(fastd_peer));