From: Marek Vavrusa Date: Thu, 16 Jun 2016 17:12:51 +0000 (-0700) Subject: daemon/worker: fix outbound TCP queries X-Git-Tag: v1.1.0~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f5e4d044f8c07e8810b9939ec4fc84addeb60ee;p=thirdparty%2Fknot-resolver.git daemon/worker: fix outbound TCP queries previously the buffer for TCP pkt reassembly was not correctly cleared and fragmented answers were rejected --- diff --git a/daemon/worker.c b/daemon/worker.c index 888e5adc9..00de593cc 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -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 {