Skip to content

Commit

Permalink
add more error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoby committed Dec 22, 2023
1 parent 58caf2d commit 1c03121
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/ziti-tunnel-cbs/ziti_dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,15 +639,17 @@ static void proxy_domain_req(struct dns_req *req, dns_domain_t *domain) {
size_t jsonlen;

if (domain->resolv_proxy != NULL) {
json = dns_message_to_json(&req->msg, 0, &jsonlen);
ZITI_LOG(DEBUG, "writing proxy resolve [%s]", json);
json = dns_message_to_json(&req->msg, MODEL_JSON_COMPACT, &jsonlen);
ZITI_LOG(DEBUG, "writing proxy resolve req[%04x]: %s", req->id, json);

// intercept_resolve_connect above can quick-fail if context does not have a valid API session
// in that case resolve_proxy connection will be in Closed state and write will fail
if (ziti_write(domain->resolv_proxy, json, jsonlen, on_proxy_write, json) == ZITI_OK) {
int rc = ziti_write(domain->resolv_proxy, json, jsonlen, on_proxy_write, json);
if (rc == ZITI_OK) {
return;
}

ZITI_LOG(WARN, "failed to write proxy resolve request[%04x]: %s", req->id, ziti_errorstr(rc));
ziti_close(domain->resolv_proxy, NULL);
domain->resolv_proxy = NULL;
}
Expand Down

0 comments on commit 1c03121

Please sign in to comment.