]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/worker: fix outbound TCP queries
authorMarek Vavrusa <marek@vavrusa.com>
Thu, 16 Jun 2016 17:12:51 +0000 (10:12 -0700)
committerMarek Vavrusa <marek@vavrusa.com>
Thu, 16 Jun 2016 17:14:14 +0000 (10:14 -0700)
previously the buffer for TCP pkt reassembly was
not correctly cleared and fragmented answers
were rejected

daemon/worker.c

index 888e5adc96238ade0de69aa1520386578f11ee4f..00de593cce9b7a865dddd5194835ba413e58f77c 100644 (file)
@@ -395,6 +395,13 @@ static int qr_task_on_send(struct qr_task *task, uv_handle_t *handle, int status
 {
        if (!task->finished) {
                if (status == 0 && handle) {
+                       /* For TCP we can be sure there will be no retransmit, so we flush
+                        * the packet buffer so it can be reused again for reassembly. */
+                       if (handle->type == UV_TCP) {
+                               knot_pkt_t *pktbuf = task->pktbuf;
+                               knot_pkt_clear(pktbuf);
+                               pktbuf->size = 0;
+                       }
                        io_start_read(handle); /* Start reading new query */
                }
        } else {