summaryrefslogtreecommitdiffstats
path: root/src/peer.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-06-10 20:46:52 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-06-10 20:46:52 +0200
commit6b139d613ae6fa127bdce1be5c634ed4b53b1efd (patch)
treefe55f6e36831ee0e2702ea085fab0e29aff8a578 /src/peer.c
parent65a09a09d6cc3e26be9488e69895154ab2ae14fd (diff)
downloadfastd-6b139d613ae6fa127bdce1be5c634ed4b53b1efd.tar
fastd-6b139d613ae6fa127bdce1be5c634ed4b53b1efd.zip
Clean up peer config loading
Instead of changing the peer list and peer group in the main conf during (re-)loading, add a parser state which contains this information.
Diffstat (limited to 'src/peer.c')
-rw-r--r--src/peer.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/peer.c b/src/peer.c
index fd123f7..5de7831 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -431,13 +431,9 @@ static void delete_peer(fastd_peer_t *peer) {
/** Allocates a new peer config */
-fastd_peer_config_t* fastd_peer_config_new(void) {
+fastd_peer_config_t* fastd_peer_config_new(fastd_peer_group_t *group) {
fastd_peer_config_t *peer = calloc(1, sizeof(fastd_peer_config_t));
-
- peer->group = conf.peer_group;
-
- peer->next = conf.peers;
- conf.peers = peer;
+ peer->group = group;
return peer;
}
@@ -458,13 +454,6 @@ void fastd_peer_config_free(fastd_peer_config_t *peer) {
free(peer);
}
-/** Deletes the peer config created last */
-void fastd_peer_config_delete(void) {
- fastd_peer_config_t *peer = conf.peers, *next = peer->next;
- fastd_peer_config_free(peer);
- conf.peers = next;
-}
-
/** Deletes a peer config, and removes the peer assiciated with the peer config */
void fastd_peer_config_purge(fastd_peer_config_t *config) {
size_t i;