diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-05 13:17:02 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-05 13:17:02 +0200 |
commit | 7b2cfb422af6a957aa90e22bd6e9b19f16b30319 (patch) | |
tree | aaa2fd85662309af45ab4fced6b332445bdf0f10 /src/peer.c | |
parent | 329d15d50c54a69ce8e2be0865124744c0bf3428 (diff) | |
download | fastd-7b2cfb422af6a957aa90e22bd6e9b19f16b30319.tar fastd-7b2cfb422af6a957aa90e22bd6e9b19f16b30319.zip |
Cleanly shutdown; add on-down command
Diffstat (limited to 'src/peer.c')
-rw-r--r-- | src/peer.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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)); |