From 7b2cfb422af6a957aa90e22bd6e9b19f16b30319 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 5 Apr 2012 13:17:02 +0200 Subject: Cleanly shutdown; add on-down command --- src/peer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/peer.c') 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)); -- cgit v1.2.3