return &session->sflags;
}
+const char *session_type_str(struct session *session)
+{
+ if (!session || !session->handle) {
+ assert(!EINVAL);
+ return "ERROR";
+ }
+ switch (session->handle->type) {
+ default:
+ assert(!EINVAL);
+ return "ERROR";
+ case UV_UDP:
+ return "UDP";
+ case UV_POLL:
+ return "XDP";
+ case UV_TCP:
+ if (session->sflags.has_http) {
+ return "DoH";
+ } else if (session->sflags.has_tls) {
+ return "DoT";
+ } else {
+ return "TCP";
+ }
+ }
+}
+
struct sockaddr *session_get_peer(struct session *session)
{
return &session->peer.ip;
bool session_is_empty(const struct session *session);
/** Get pointer to session flags */
struct session_flags *session_flags(struct session *session);
+/** Get the type of session as string (UDP, TCP, DoT, DoH, XDP). */
+const char *session_type_str(struct session *session);
/** Get pointer to peer address. */
struct sockaddr *session_get_peer(struct session *session);
/** Get pointer to sockname (address of our end, not meaningful for UDP downstream). */
struct session* s = handle->data;
assert(s);
+ struct kr_request *req = &task->ctx->req;
+ struct kr_query *qry = array_tail(req->rplan.pending);
+ const bool is_verbose = VERBOSE_STATUS || kr_log_rtrace_enabled(req);
+ if (is_verbose && !session_flags(s)->outgoing) {
+ // we're after finish phase, so policy.DEBUG_IF cases will lose this line
+ kr_log_req(req, 0, 0, "wrkr", "sending reply over %s: %s\n",
+ session_type_str(s), kr_strerror(status));
+ } else if (is_verbose && session_flags(s)->outgoing && status) {
+ VERBOSE_MSG(qry, "sending query over %s: %s\n",
+ session_type_str(s), kr_strerror(status));
+ }
+
if (handle->type == UV_UDP && session_flags(s)->outgoing) {
// This should ensure that we are only dealing with our question to upstream
assert(!knot_wire_get_qr(task->pktbuf->wire));
// start the timer
- struct kr_query *qry = array_tail(task->ctx->req.rplan.pending);
assert(qry != NULL);
(void)qry;
size_t timeout = task->transport->timeout;