diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-08-18 22:30:30 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-08-18 22:30:30 +0200 |
commit | 50d9aa23342f8a9bc6a87ace12578054eeff36fd (patch) | |
tree | d0f2dab9535a25435e33169828e2231f96b0f2c7 /src/peer.c | |
parent | cb3c88e020dbfd028f7d8b79b9bf97bcb0b34ea5 (diff) | |
download | fastd-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; |