aboutsummaryrefslogtreecommitdiffstats
path: root/net/adns.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-01-31 19:54:56 +0000
committerMatthew Wild <mwild1@gmail.com>2010-01-31 19:54:56 +0000
commitf19f87250a105d2c8b8889d43957a7c189b25304 (patch)
tree397c057219afa054f0bba298fabc05769d7257e1 /net/adns.lua
parente1a8c869705c9e2af9850714b1c08dd24fb36e22 (diff)
downloadprosody-f19f87250a105d2c8b8889d43957a7c189b25304.tar.gz
prosody-f19f87250a105d2c8b8889d43957a7c189b25304.zip
net.adns: Use different flavour of voodoo to make UDP sockets work smoothly with libevent (no packet merging)
Diffstat (limited to 'net/adns.lua')
-rw-r--r--net/adns.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/adns.lua b/net/adns.lua
index e8ea3d28..005bc606 100644
--- a/net/adns.lua
+++ b/net/adns.lua
@@ -14,6 +14,8 @@ local log = require "util.logger".init("adns");
local t_insert, t_remove = table.insert, table.remove;
local coroutine, tostring, pcall = coroutine, tostring, pcall;
+local function dummy_send(sock, data, i, j) return (j-i)+1; end
+
module "adns"
function lookup(handler, qname, qtype, qclass)
@@ -65,9 +67,10 @@ function new_async_socket(sock, resolver)
handler.settimeout = function () end
handler.setsockname = function (_, ...) return sock:setsockname(...); end
- handler.setpeername = function (_, ...) peername = (...); local ret = sock:setpeername(...); _:set_send(sock.send); return ret; end
+ handler.setpeername = function (_, ...) peername = (...); local ret = sock:setpeername(...); _:set_send(dummy_send); return ret; end
handler.connect = function (_, ...) return sock:connect(...) end
- handler.send = function (_, data) _:write(data); return _.sendbuffer and _.sendbuffer(); end
+ --handler.send = function (_, data) _:write(data); return _.sendbuffer and _.sendbuffer(); end
+ handler.send = function (_, data) return sock:send(data); end
return handler;
end