diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-07-25 13:49:01 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-07-25 13:49:01 +0200 |
commit | fcc5bcad1add369b7b9e0a25cc63b88dfb83e5fe (patch) | |
tree | 87c22a602541d499d2a416e42facaa2a74ea4aae /src/fastd.c | |
parent | 530c6eaf60cb76ab79b326c348b2039ed396e687 (diff) | |
download | fastd-fcc5bcad1add369b7b9e0a25cc63b88dfb83e5fe.tar fastd-fcc5bcad1add369b7b9e0a25cc63b88dfb83e5fe.zip |
Improve handling of similar remote resolves
Diffstat (limited to 'src/fastd.c')
-rw-r--r-- | src/fastd.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/fastd.c b/src/fastd.c index a142cb2..63e77c5 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -850,7 +850,7 @@ static void handle_tasks(fastd_context_t *ctx) { if (!task->peer->next_remote) task->peer->next_remote = task->peer->remotes; - if (fastd_peer_remote_is_dynamic(task->peer->next_remote)) + if (fastd_remote_is_dynamic(task->peer->next_remote)) fastd_resolve_peer(ctx, task->peer, task->peer->next_remote); break; @@ -1078,14 +1078,6 @@ static void handle_resolve_returns(fastd_context_t *ctx) { exit_errno(ctx, "handle_resolve_return: read"); } - char hostname[resolve_return.hostname_len+1]; - while (read(ctx->resolverfd, hostname, resolve_return.hostname_len) < 0) { - if (errno != EINTR) - exit_errno(ctx, "handle_resolve_return: read"); - } - - hostname[resolve_return.hostname_len] = 0; - fastd_peer_t *peer; for (peer = ctx->peers; peer; peer = peer->next) { if (!peer->config) @@ -1093,7 +1085,7 @@ static void handle_resolve_returns(fastd_context_t *ctx) { fastd_remote_t *remote; for (remote = peer->remotes; remote; remote = remote->next) { - if (strequal(remote->config->hostname, hostname) && fastd_peer_remote_matches_dynamic(remote->config, &resolve_return.constraints)) + if (remote == resolve_return.remote) break; } @@ -1104,6 +1096,8 @@ static void handle_resolve_returns(fastd_context_t *ctx) { break; } + + fastd_remote_unref(resolve_return.remote); } static inline void handle_socket_error(fastd_context_t *ctx, fastd_socket_t *sock) { |