Software /
code /
prosody
Changeset
2558:0a65fc0c7bee
net.adns: Use different flavour of voodoo to make UDP sockets work smoothly with libevent (no packet merging)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 31 Jan 2010 19:54:56 +0000 |
parents | 2557:e5254ccd5ef8 |
children | 2559:a90a00ebae25 |
files | net/adns.lua |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/net/adns.lua Sun Jan 31 19:27:52 2010 +0000 +++ b/net/adns.lua Sun Jan 31 19:54:56 2010 +0000 @@ -14,6 +14,8 @@ 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 @@ 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