]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon: renamed is_subreq -> outgoing
authorMarek Vavrusa <marek@vavrusa.com>
Wed, 11 May 2016 00:11:41 +0000 (17:11 -0700)
committerMarek Vavrusa <marek@vavrusa.com>
Wed, 11 May 2016 00:11:41 +0000 (17:11 -0700)
daemon/io.c
daemon/io.h
daemon/worker.c

index 439d2a947afdec76291a2e60d9ad50abecd74c56..ae079140f9396ec345e736ed4d4032eb26f702d3 100644 (file)
@@ -47,7 +47,7 @@ static void check_bufsize(uv_handle_t* handle)
 
 static void session_clear(struct session *s)
 {
-       assert(s->is_subreq || s->tasks.len == 0);
+       assert(s->outgoing || s->tasks.len == 0);
        array_clear(s->tasks);
        memset(s, 0, sizeof(*s));
 }
@@ -112,7 +112,7 @@ static void handle_getbuf(uv_handle_t* handle, size_t suggested_size, uv_buf_t*
        if (handle->type == UV_TCP) {
                buf->len = MIN(suggested_size, 4096);
        /* Regular buffer size for subrequests. */
-       } else if (session->is_subreq) {
+       } else if (session->outgoing) {
                buf->len = suggested_size;
        /* Use recvmmsg() on master sockets if possible. */
        } else {
@@ -186,7 +186,7 @@ static void tcp_recv(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf)
                worker_end_tcp(worker, (uv_handle_t *)handle);
                /* Exceeded per-connection quota for outstanding requests
                 * stop reading from stream and close after last message is processed. */
-               if (!s->is_subreq && !uv_is_closing((uv_handle_t *)&s->timeout)) {
+               if (!s->outgoing && !uv_is_closing((uv_handle_t *)&s->timeout)) {
                        uv_timer_stop(&s->timeout);
                        if (s->tasks.len == 0) {
                                uv_close((uv_handle_t *)&s->timeout, tcp_timeout);
@@ -195,7 +195,7 @@ static void tcp_recv(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf)
                        }
                }
        /* Connection spawned more than one request, reset its deadline for next query. */
-       } else if (ret > 0 && !s->is_subreq) {
+       } else if (ret > 0 && !s->outgoing) {
                uv_timer_again(&s->timeout);
        }
        mp_flush(worker->pkt_pool.ctx);
index 5cdd2de761aa1acdab8480fd68202919614d038c..bcfa8d68088b367b783c00807bebd63b38a5f7d9 100644 (file)
@@ -26,7 +26,7 @@ struct qr_task;
  * that exists between remote counterpart and a local socket.
  */
 struct session {
-       bool is_subreq;
+       bool outgoing;
     bool throttled;
     uv_timer_t timeout;
     struct qr_task *buffering;
index 112ce4eb0cf889b1c9b6f281c8cc67312a7cd912..0555778492e1e5ac86ac1329fac8de88bee70eb1 100644 (file)
@@ -109,7 +109,7 @@ static uv_handle_t *ioreq_spawn(struct qr_task *task, int socktype)
        io_create(task->worker->loop, handle, socktype);
        /* Set current handle as a subrequest type. */
        struct session *session = handle->data;
-       session->is_subreq = true;
+       session->outgoing = true;
        int ret = array_push(session->tasks, task);
        if (ret != 0) {
                io_deinit(handle);
@@ -756,7 +756,7 @@ int worker_submit(struct worker_ctx *worker, uv_handle_t *handle, knot_pkt_t *ms
 
        /* Start new task on listening sockets, or resume if this is subrequest */
        struct qr_task *task = NULL;
-       if (!session->is_subreq) {
+       if (!session->outgoing) {
                /* Ignore badly formed queries or responses. */
                if (!msg || ret != 0 || knot_wire_get_qr(msg->wire)) {
                        if (msg) worker->stats.dropped += 1;
@@ -803,7 +803,7 @@ int worker_end_tcp(struct worker_ctx *worker, uv_handle_t *handle)
         * because in this case session doesn't own tasks, it has just
         * borrowed the task from parent session. */
        struct session *session = handle->data;
-       if (session->is_subreq) {
+       if (session->outgoing) {
                worker_submit(worker, (uv_handle_t *)handle, NULL, NULL);       
        } else {
                discard_buffered(session);
@@ -836,7 +836,7 @@ int worker_process_tcp(struct worker_ctx *worker, uv_handle_t *handle, const uin
 
        /* If this is a new query, create a new task that we can use
         * to buffer incoming message until it's complete. */
-       if (!session->is_subreq) {
+       if (!session->outgoing) {
                if (!task) {
                        task = qr_task_create(worker, handle, NULL);
                        if (!task) {
@@ -889,7 +889,7 @@ int worker_process_tcp(struct worker_ctx *worker, uv_handle_t *handle, const uin
                task->bytes_remaining = 0;
                /* Parse the packet and start resolving complete query */
                int ret = parse_packet(pkt_buf);
-               if (ret == 0 && !session->is_subreq) {
+               if (ret == 0 && !session->outgoing) {
                        ret = qr_task_start(task, pkt_buf);
                        if (ret != 0) {
                                return ret;
@@ -910,7 +910,7 @@ int worker_process_tcp(struct worker_ctx *worker, uv_handle_t *handle, const uin
                if (ret != 0) {
                        return ret;
                }
-               if (len - to_read > 0 && !session->is_subreq) {
+               if (len - to_read > 0 && !session->outgoing) {
                        ret = worker_process_tcp(worker, handle, msg + to_read, len - to_read);
                        if (ret < 0) {
                                return ret;