context setters that can be called after create

getdns_context_set_namespaces and getdns_context_set_upstream_recursive_servers
can also be called after context create now.
This commit is contained in:
Willem Toorop 2014-10-28 14:23:40 +01:00
parent c279a093b2
commit 4740d0baf4
1 changed files with 3 additions and 11 deletions

View File

@ -871,9 +871,6 @@ getdns_context_set_namespaces(struct getdns_context *context,
if (namespace_count == 0 || namespaces == NULL) { if (namespace_count == 0 || namespaces == NULL) {
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL; return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
} }
if (context->resolution_type_set != 0) {
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
for(i=0; i<namespace_count; i++) for(i=0; i<namespace_count; i++)
{ {
@ -995,11 +992,10 @@ getdns_context_set_follow_redirects(struct getdns_context *context,
getdns_redirects_t value) getdns_redirects_t value)
{ {
RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER); RETURN_IF_NULL(context, GETDNS_RETURN_INVALID_PARAMETER);
if (value != GETDNS_REDIRECTS_FOLLOW && value != GETDNS_REDIRECTS_DO_NOT_FOLLOW)
return GETDNS_RETURN_INVALID_PARAMETER;
context->follow_redirects = value; context->follow_redirects = value;
if (context->resolution_type_set != 0) {
/* already setup */
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
dispatch_updated(context, GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS); dispatch_updated(context, GETDNS_CONTEXT_CODE_FOLLOW_REDIRECTS);
return GETDNS_RETURN_GOOD; return GETDNS_RETURN_GOOD;
@ -1174,10 +1170,6 @@ getdns_context_set_upstream_recursive_servers(struct getdns_context *context,
if (count == 0 || r != GETDNS_RETURN_GOOD) { if (count == 0 || r != GETDNS_RETURN_GOOD) {
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL; return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
} }
if (context->resolution_type_set != 0) {
/* already setup */
return GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
memset(&hints, 0, sizeof(struct addrinfo)); memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = 0; /* Datagram socket */ hints.ai_socktype = 0; /* Datagram socket */