summaryrefslogtreecommitdiffstats
path: root/src/resolve.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-07-24 18:44:43 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-07-24 18:44:43 +0200
commitaae5265eb5ebe806414f383f99bb765dbdcaee4b (patch)
tree273d2fea4500adc4419a3f5ed080d355012ce621 /src/resolve.c
parentbbe0c1f725cea65f871918cadd391d7b01a86403 (diff)
downloadfastd-aae5265eb5ebe806414f383f99bb765dbdcaee4b.tar
fastd-aae5265eb5ebe806414f383f99bb765dbdcaee4b.zip
Allow specifying multiple remote entries for a single peer
Diffstat (limited to 'src/resolve.c')
-rw-r--r--src/resolve.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/resolve.c b/src/resolve.c
index 103ba5f..5a18002 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -99,27 +99,27 @@ static void* resolve_peer(void *varg) {
return NULL;
}
-void fastd_resolve_peer(fastd_context_t *ctx, fastd_peer_t *peer) {
+void fastd_resolve_peer(fastd_context_t *ctx, fastd_peer_t *peer, fastd_remote_t *remote) {
if (!peer->config)
exit_bug(ctx, "trying to resolve temporary peer");
- if (timespec_after(&peer->last_resolve, &peer->last_resolve_return)) {
+ if (timespec_after(&remote->last_resolve, &remote->last_resolve_return)) {
pr_debug(ctx, "not resolving %P as there is already a resolve running", peer);
return;
}
- if (timespec_diff(&ctx->now, &peer->last_resolve) < ctx->conf->min_resolve_interval*1000) {
+ if (timespec_diff(&ctx->now, &remote->last_resolve) < ctx->conf->min_resolve_interval*1000) {
/* last resolve was just a few seconds ago */
return;
}
- pr_verbose(ctx, "resolving host `%s' for peer %P...", peer->config->hostname, peer);
+ pr_verbose(ctx, "resolving host `%s' for peer %P...", remote->config->hostname, peer);
resolv_arg_t *arg = malloc(sizeof(resolv_arg_t));
arg->ctx = ctx;
- arg->hostname = strdup(peer->config->hostname);
- arg->constraints = peer->config->address;
+ arg->hostname = strdup(remote->config->hostname);
+ arg->constraints = remote->config->address;
pthread_t thread;
if (pthread_create(&thread, NULL, resolve_peer, arg) != 0) {
@@ -132,5 +132,5 @@ void fastd_resolve_peer(fastd_context_t *ctx, fastd_peer_t *peer) {
}
pthread_detach(thread);
- peer->last_resolve = ctx->now;
+ remote->last_resolve = ctx->now;
}