summaryrefslogtreecommitdiffstats
path: root/src/peer.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-08-18 22:30:30 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-08-18 22:30:30 +0200
commit50d9aa23342f8a9bc6a87ace12578054eeff36fd (patch)
treed0f2dab9535a25435e33169828e2231f96b0f2c7 /src/peer.c
parentcb3c88e020dbfd028f7d8b79b9bf97bcb0b34ea5 (diff)
downloadfastd-50d9aa23342f8a9bc6a87ace12578054eeff36fd.tar
fastd-50d9aa23342f8a9bc6a87ace12578054eeff36fd.zip
Dynamically create peer configs for dynamic peers
This avoids duplicating the protocol_config field.
Diffstat (limited to 'src/peer.c')
-rw-r--r--src/peer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/peer.c b/src/peer.c
index ac711f0..f621010 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -424,7 +424,7 @@ static void delete_peer(fastd_peer_t *peer) {
conf.protocol->free_peer_state(peer);
if (fastd_peer_is_dynamic(peer))
- free(peer->protocol_config);
+ fastd_peer_config_free(peer->config);
for (i = 0; i < VECTOR_LEN(peer->remotes); i++)
free(VECTOR_INDEX(peer->remotes, i).addresses);
@@ -718,7 +718,6 @@ fastd_peer_t* fastd_peer_add(fastd_peer_config_t *peer_conf) {
if (peer_conf) {
peer->config = peer_conf;
- peer->protocol_config = peer_conf->protocol_config;
VECTOR_ALLOC(peer->remotes, 0);
@@ -742,6 +741,8 @@ fastd_peer_t* fastd_peer_add(fastd_peer_config_t *peer_conf) {
if (!fastd_shell_command_isset(&conf.on_verify))
exit_bug("tried to add dynamic peer without on-verify command");
+ peer->config = fastd_peer_config_new(conf.peer_group);
+
peer->dynamic = true;
peer->verify_timeout = ctx.now;