aboutsummaryrefslogtreecommitdiffstats
path: root/net/unbound.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-06-25 17:56:48 +0200
committerKim Alvefur <zash@zash.se>2020-06-25 17:56:48 +0200
commit740bb5ee8dd557eb16c473a12605c52d49a65166 (patch)
tree0b81b1de21eb6b081f716c003970ad6ce581315e /net/unbound.lua
parent639e6eb3e0d1d1370fa41f67cebccf4adeb0701f (diff)
downloadprosody-740bb5ee8dd557eb16c473a12605c52d49a65166.tar.gz
prosody-740bb5ee8dd557eb16c473a12605c52d49a65166.zip
net.unbound: Strip support for legacy net.server APIs
These are not needed since the watchfd API is provided by all net.server backends.
Diffstat (limited to 'net/unbound.lua')
-rw-r--r--net/unbound.lua40
1 files changed, 3 insertions, 37 deletions
diff --git a/net/unbound.lua b/net/unbound.lua
index df26cd36..dbf010ea 100644
--- a/net/unbound.lua
+++ b/net/unbound.lua
@@ -12,8 +12,6 @@ local s_format = string.format;
local s_lower = string.lower;
local s_upper = string.upper;
local noop = function() end;
-local zero = function() return 0 end;
-local truop = function() return true; end;
local log = require "util.logger".init("unbound");
local net_server = require "net.server";
@@ -47,41 +45,9 @@ end
-- Note: libunbound will default to using root hints if resolvconf is unset
local function connect_server(unbound, server)
- if server.watchfd then
- return server.watchfd(unbound, function ()
- unbound:process()
- end);
- elseif server.event and server.addevent then
- local EV_READ = server.event.EV_READ;
- local function event_callback()
- unbound:process();
- return EV_READ;
- end
- return server.addevent(unbound:getfd(), EV_READ, event_callback)
- elseif server.wrapclient then
- local conn = {
- getfd = function()
- return unbound:getfd();
- end,
-
- send = zero,
- receive = noop,
- settimeout = noop,
- close = truop,
- }
-
- local function process()
- unbound:process();
- end
- local listener = {
- onincoming = process,
-
- onconnect = noop,
- ondisconnect = noop,
- onreadtimeout = truop,
- };
- return server.wrapclient(conn, "dns", 0, listener, "*a" );
- end
+ return server.watchfd(unbound, function ()
+ unbound:process()
+ end);
end
local unbound = libunbound.new(unbound_config);