From 2191e065dcdcf5816a52645b91f0be53d971ed13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Vavru=C5=A1a?= <marek.vavrusa@nic.cz>
Date: Tue, 8 Dec 2015 13:36:05 +0100
Subject: [PATCH] daemon/lua: update defaults (both v4/v6 localhost, 100M
 cache)

---
 daemon/lua/config.lua | 7 ++++---
 daemon/worker.c       | 7 ++-----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/daemon/lua/config.lua b/daemon/lua/config.lua
index b8c61de13..a417a0b54 100644
--- a/daemon/lua/config.lua
+++ b/daemon/lua/config.lua
@@ -1,10 +1,11 @@
 -- Listen on localhost
 if not next(net.list()) then
-	if not pcall(net.listen, '127.0.0.1') then
-		error('failed to bind to localhost#53')
+	local ok, err = pcall(net.listen, {'127.0.0.1', '::1'})
+	if not ok then
+		error('bind to localhost#53 '..err)
 	end
 end
 -- Open cache if not set/disabled
 if not cache.current_size then
-	cache.size = 10 * MB
+	cache.size = 100 * MB
 end
\ No newline at end of file
diff --git a/daemon/worker.c b/daemon/worker.c
index 8872a0be3..cb5dd83b9 100644
--- a/daemon/worker.c
+++ b/daemon/worker.c
@@ -443,14 +443,11 @@ static void on_connect(uv_connect_t *req, int status)
 	struct qr_task *task = req->data;
 	uv_stream_t *handle = req->handle;
 	if (qr_valid_handle(task, (uv_handle_t *)req->handle)) {
-		struct sockaddr_in6 addr;
-		int addrlen = sizeof(addr); /* Retrieve endpoint IP for statistics */
-		uv_tcp_getpeername((uv_tcp_t *)handle, (struct sockaddr *)&addr, &addrlen);
 		if (status == 0) {
-			qr_task_send(task, (uv_handle_t *)handle, (struct sockaddr *)&addr, task->pktbuf);
+			qr_task_send(task, (uv_handle_t *)handle, NULL, task->pktbuf);
 		} else {
 			DEBUG_MSG("ioreq conn_done %p => %d, %s\n", req, status, uv_strerror(status));
-			qr_task_step(task, (struct sockaddr *)&addr, NULL);
+			qr_task_step(task, task->addrlist, NULL);
 		}
 	}
 	qr_task_unref(task);
-- 
GitLab