Lua socket.dns.toip wont work in lane thread worker

I am trying to create multithreaded watcher, which try to check hostname. The simple code demonstrate general idea. But i got strange behavior of script when i call sock.dns.toip in thread worker. Worker do not executed. If i exclude socket code from worker, all work perfectly.

how to run socket.dns.toip in thread worker?

local lanes = require "lanes".configure()
local linda = lanes.linda()


local function resolver(name)
    while true do
        local socket = assert(require "socket")
        local _, resolve = socket.dns.toip(string.format("%s.", "www.google.com"))
        print('resolver[' .. name ..']')
    end
end

lanes.gen("", resolver)('a')
os.execute("sleep 0.1")

Upvotes: 0

Views: 329

Answers (0)

Related Questions