Verified Commit 94d9b16e authored by Grigorii Demidov's avatar Grigorii Demidov Committed by Vladimír Čunát

daemon: fix rebase errors

parent 328fa4bd
......@@ -263,12 +263,12 @@ static void _tcp_accept(uv_stream_t *master, int status, bool tls)
/* struct session was allocated \ borrowed from memory pool. */
struct session *session = client->data;
assert(session->outgoing == false);
assert(session_is_outgoing(session) == false);
if (uv_accept(master, client) != 0) {
/* close session, close underlying uv handles and
* deallocate (or return to memory pool) memory. */
worker_session_close(session);
session_close(session);
return;
}
......@@ -286,7 +286,6 @@ static void _tcp_accept(uv_stream_t *master, int status, bool tls)
return;
}
struct worker_ctx *worker = (struct worker_ctx *)master->loop->data;
const struct engine *engine = worker->engine;
const struct network *net = &engine->net;
uint64_t idle_in_timeout = net->tcp.in_idle_timeout;
......@@ -430,6 +429,7 @@ int io_create(uv_loop_t *loop, uv_handle_t *handle, int type, unsigned family)
uv_timer_t *t = session_get_timer(s);
t->data = s;
uv_timer_init(worker->loop, t);
return ret;
}
void io_deinit(uv_handle_t *handle)
......
......@@ -121,9 +121,9 @@ static ssize_t kres_gnutls_vec_push(gnutls_transport_ptr_t h, const giovec_t * i
return 0;
}
assert(t->session && t->session->handle &&
t->session->handle->type == UV_TCP);
uv_stream_t *handle = (uv_stream_t *)t->session->handle;
assert(t->session);
uv_stream_t *handle = (uv_stream_t *)session_get_handle(t->session);
assert(handle && handle->type == UV_TCP);
/*
* This is a little bit complicated. There are two different writes:
......@@ -239,8 +239,9 @@ static int tls_handshake(struct tls_common_ctx *ctx, tls_handshake_cb handshake_
if (err == GNUTLS_E_SUCCESS) {
/* Handshake finished, return success */
ctx->handshake_state = TLS_HS_DONE;
struct sockaddr *peer = session_get_peer(session);
kr_log_verbose("[%s] TLS handshake with %s has completed\n",
logstring, kr_straddr(&session->peer.ip));
logstring, kr_straddr(peer));
if (handshake_cb) {
handshake_cb(session, 0);
}
......@@ -259,8 +260,9 @@ static int tls_handshake(struct tls_common_ctx *ctx, tls_handshake_cb handshake_
/* Handle warning when in verbose mode */
const char *alert_name = gnutls_alert_get_name(gnutls_alert_get(ctx->tls_session));
if (alert_name != NULL) {
struct sockaddr *peer = session_get_peer(session);
kr_log_verbose("[%s] TLS alert from %s received: %s\n",
logstring, kr_straddr(&session->peer.ip), alert_name);
logstring, kr_straddr(peer), alert_name);
}
}
return kr_ok();
......
......@@ -801,8 +801,8 @@ static int qr_task_send(struct qr_task *task, uv_handle_t *handle,
/* Send using given protocol */
struct session *session = handle->data;
assert(session->closing == false);
if (session->has_tls) {
assert(!session_is_closing(session));
if (session_has_tls(session)) {
uv_write_t *write_req = (uv_write_t *)ioreq;
write_req->data = task;
ret = tls_write(write_req, handle, pkt, &on_task_write);
......@@ -843,7 +843,7 @@ static int qr_task_send(struct qr_task *task, uv_handle_t *handle,
if (ctx->source.session &&
handle != session_get_handle(ctx->source.session) &&
addr) {
if (session->has_tls)
if (session_has_tls(session))
worker->stats.tls += 1;
else if (handle->type == UV_UDP)
worker->stats.udp += 1;
......
......@@ -78,10 +78,6 @@ void *worker_iohandle_borrow(struct worker_ctx *worker);
void worker_iohandle_release(struct worker_ctx *worker, void *h);
ssize_t worker_gnutls_push(gnutls_transport_ptr_t h, const void *buf, size_t len);
ssize_t worker_gnutls_client_push(gnutls_transport_ptr_t h, const void *buf, size_t len);
int worker_task_step(struct qr_task *task, const struct sockaddr *packet_source,
knot_pkt_t *packet);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment