diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-06-10 20:46:52 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-06-10 20:46:52 +0200 |
commit | 6b139d613ae6fa127bdce1be5c634ed4b53b1efd (patch) | |
tree | fe55f6e36831ee0e2702ea085fab0e29aff8a578 /src/options.c | |
parent | 65a09a09d6cc3e26be9488e69895154ab2ae14fd (diff) | |
download | fastd-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/options.c')
-rw-r--r-- | src/options.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/options.c b/src/options.c index 7ac026e..63115ef 100644 --- a/src/options.c +++ b/src/options.c @@ -111,21 +111,25 @@ static void option_config(const char *arg) { if (!strcmp(arg, "-")) arg = NULL; - if (!fastd_read_config(arg, false, 0)) + if (!fastd_config_read(arg, conf.peer_group, NULL, 0)) exit(1); } /** Handles the --config-peer option */ static void option_config_peer(const char *arg) { - fastd_peer_config_new(); + fastd_peer_config_t *peer = fastd_peer_config_new(conf.peer_group); - if(!fastd_read_config(arg, true, 0)) + if(!fastd_config_read(arg, conf.peer_group, peer, 0)) exit(1); + + peer->next = conf.peers; + conf.peers = peer; + } /** Handles the --config-peer-dir option */ static void option_config_peer_dir(const char *arg) { - fastd_add_peer_dir(arg); + fastd_config_add_peer_dir(conf.peer_group, arg); } |