1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00

resolved: remove duplicate handling of "no servers" query result

So far we handled immediate "no server" query results differently from
"no server" results we ran into during operation: the former would cause
the dns_query_go() call to fail with ESRCH, the later would result in
the query completion callback to be called.

Remove the duplicate codepaths, by always going through the completion
callback. This allows us to remove quite a number of lines for handling
the ESRCH.

This commit should not alter behaviour at all.
This commit is contained in:
Lennart Poettering 2015-08-24 23:44:33 +02:00
parent da0c630e14
commit d634711b26
2 changed files with 2 additions and 22 deletions

View File

@ -226,10 +226,6 @@ static void bus_method_resolve_hostname_complete(DnsQuery *q) {
* query, this time with the cname */ * query, this time with the cname */
if (added <= 0) { if (added <= 0) {
r = dns_query_go(q); r = dns_query_go(q);
if (r == -ESRCH) {
r = sd_bus_reply_method_errorf(q->request, BUS_ERROR_NO_NAME_SERVERS, "No appropriate name servers or networks for name found");
goto finish;
}
if (r < 0) { if (r < 0) {
r = sd_bus_reply_method_errno(q->request, -r, NULL); r = sd_bus_reply_method_errno(q->request, -r, NULL);
goto finish; goto finish;
@ -346,10 +342,6 @@ static int bus_method_resolve_hostname(sd_bus_message *message, void *userdata,
r = dns_query_go(q); r = dns_query_go(q);
if (r < 0) { if (r < 0) {
dns_query_free(q); dns_query_free(q);
if (r == -ESRCH)
sd_bus_error_setf(error, BUS_ERROR_NO_NAME_SERVERS, "No appropriate name servers or networks for name found");
return r; return r;
} }
@ -494,10 +486,6 @@ static int bus_method_resolve_address(sd_bus_message *message, void *userdata, s
r = dns_query_go(q); r = dns_query_go(q);
if (r < 0) { if (r < 0) {
dns_query_free(q); dns_query_free(q);
if (r == -ESRCH)
sd_bus_error_setf(error, BUS_ERROR_NO_NAME_SERVERS, "No appropriate name servers or networks for name found");
return r; return r;
} }
@ -647,10 +635,6 @@ static int bus_method_resolve_record(sd_bus_message *message, void *userdata, sd
r = dns_query_go(q); r = dns_query_go(q);
if (r < 0) { if (r < 0) {
dns_query_free(q); dns_query_free(q);
if (r == -ESRCH)
sd_bus_error_setf(error, BUS_ERROR_NO_NAME_SERVERS, "No appropriate name servers or networks for name found");
return r; return r;
} }

View File

@ -651,14 +651,10 @@ int dns_query_go(DnsQuery *q) {
DnsTransactionState state = DNS_TRANSACTION_NO_SERVERS; DnsTransactionState state = DNS_TRANSACTION_NO_SERVERS;
dns_query_synthesize_reply(q, &state); dns_query_synthesize_reply(q, &state);
if (state != DNS_TRANSACTION_NO_SERVERS) {
dns_query_complete(q, state); dns_query_complete(q, state);
return 1; return 1;
} }
return -ESRCH;
}
r = dns_query_add_transaction_split(q, first); r = dns_query_add_transaction_split(q, first);
if (r < 0) if (r < 0)
goto fail; goto fail;