Software /
code /
prosody
Diff
net/adns.lua @ 2128:f107f0205793
net.adns: Update for new net.server API (doesn't work with libevent yet)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 22 Nov 2009 04:42:47 +0000 |
parent | 1901:3c52b949e472 |
child | 2232:aa8db84ae69d |
line wrap: on
line diff
--- a/net/adns.lua Sun Nov 22 04:42:03 2009 +0000 +++ b/net/adns.lua Sun Nov 22 04:42:47 2009 +0000 @@ -45,10 +45,10 @@ function new_async_socket(sock, resolver) local newconn, peername = {}, "<unknown>"; local listener = {}; - function listener.incoming(conn, data) + function listener.onincoming(conn, data) dns.feed(sock, data); end - function listener.disconnect(conn, err) + function listener.ondisconnect(conn, err) log("warn", "DNS socket for %s disconnected: %s", peername, err); local servers = resolver.server; if resolver.socketset[newconn.handler] == resolver.best_server and resolver.best_server == #servers then @@ -68,7 +68,7 @@ newconn.handler.setsockname = function (_, ...) return sock:setsockname(...); end newconn.handler.setpeername = function (_, ...) peername = (...); local ret = sock:setpeername(...); _.setsend(sock.send); return ret; end newconn.handler.connect = function (_, ...) return sock:connect(...) end - newconn.handler.send = function (_, data) _.write(data); return _.sendbuffer(); end + newconn.handler.send = function (_, data) _.write(_, data); return _.sendbuffer(); end return newconn.handler; end