A bit more consistency in user_callback usage

This commit is contained in:
Willem Toorop 2017-02-19 09:47:41 +01:00
parent 8fccd66813
commit b3a06f1944
1 changed files with 11 additions and 16 deletions

View File

@ -54,24 +54,19 @@
#include "dict.h" #include "dict.h"
#include "mdns.h" #include "mdns.h"
void _getdns_call_user_callback(getdns_dns_req *dns_req, void _getdns_call_user_callback(getdns_dns_req *dnsreq, getdns_dict *response)
struct getdns_dict *response)
{ {
struct getdns_context *context = dns_req->context; _getdns_context_clear_outbound_request(dnsreq);
getdns_transaction_t trans_id = dns_req->trans_id;
getdns_callback_t cb = dns_req->user_callback;
void *user_arg = dns_req->user_pointer;
/* clean up */ if (dnsreq->user_callback) {
_getdns_context_clear_outbound_request(dns_req); dnsreq->context->processing = 1;
dnsreq->user_callback(dnsreq->context,
context->processing = 1; (response ? GETDNS_CALLBACK_COMPLETE
cb(context, : GETDNS_CALLBACK_ERROR),
(response ? GETDNS_CALLBACK_COMPLETE : GETDNS_CALLBACK_ERROR), response, dnsreq->user_pointer, dnsreq->trans_id);
response, user_arg, trans_id); dnsreq->context->processing = 0;
context->processing = 0; }
_getdns_dns_req_free(dnsreq);
_getdns_dns_req_free(dns_req);
} }
static int static int