-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Advice for running of LuaJIT version < 2.0.1 #1
Comments
For those interested I think (?) these two issues can be resolved by using local cbuf
if func_ct == 'LPFN_CONNECTEX' then
cbuf = ffi.new(ffi.typeof('LPFN_CONNECTEX'..'[1]'))
elseif func_ct == 'LPFN_ACCEPTEX' then
cbuf = ffi.new(ffi.typeof('LPFN_ACCEPTEX'..'[1]'))
end and local overlapped_ptr_ct = ffi.typeof([[struct {
OVERLAPPED overlapped;
int job_index;
}
]].."*") respectively. Still getting an error do
local function pass(thread, ...)
wait_count = wait_count - 1
waiting[thread] = nil
return ...
end
--[[local]] function wait(register)
local thread, is_main = currentthread()
assert(not is_main, 'trying to perform I/O from the main thread')
wait_count = wait_count + 1
if register ~= false then
waiting[thread] = true
end
return pass(thread, restore(transfer(poll_thread)))
end
end but think that might be to using lua 5.1 (instead of 5.2) (and due to this using the May 7th build of coro, where the main thread is nil) and not due to the older version of LuaJIT... |
For now will try using the May 22nd version of sock with the above changes and additionally changing local function local function make_async(for_writing, f, wait_errno)
return function(self, expires, ...)
::again::
local ret = f(self, ...)
if ret == 0 then return nil, 'closed' end
if ret > 0 then return ret end
if ffi.errno() == wait_errno then
if for_writing then
self.send_expires = expires
if expires then
send_expires_heap:push(self)
end
self.send_thread = coro.running()
else
self.recv_expires = expires
if expires then
recv_expires_heap:push(self)
end
self.recv_thread = coro.running()
end
local ok, err = wait()
if not ok then
if err == 'timeout' then
self:close()
end
return nil, err
end
goto again
end
return check()
end
end with local function make_async(for_writing, f, wait_errno)
return function(self, expires, ...)
local test = true
while(test) do
-- ::again::
local ret = f(self, ...)
if ret == 0 then return nil, 'closed' end
if ret > 0 then return ret end
if ffi.errno() == wait_errno then
if for_writing then
self.send_expires = expires
if expires then
send_expires_heap:push(self)
end
self.send_thread = coro.running()
else
self.recv_expires = expires
if expires then
recv_expires_heap:push(self)
end
self.recv_thread = coro.running()
end
local ok, err = wait()
if not ok then
if err == 'timeout' then
self:close()
end
return nil, err
end
-- goto again
else
test = false
end
end
return check()
end
end and function socket:addr(host, port, flags)
return M.addr(host, port, self._st, self._af, self._pr, addr_flags)
end to function socket:addr(host, port, addr_flags)
return M.addr(host, port, self._st, self._af, self._pr, addr_flags)
end to maintain compatibility with Lua 5.1. Hopefully this doesn't cause any issues with the mysql module. |
Hmm... with this still getting error |
You showed my how you modified the code but you forgot to show the code that actually tries to connect to mysql. That code should be wrapped in sock.run() or sock.thread(). I suggest you look at tests/demos and make those work first. |
Ah that makes sense, sometimes you overlook the most simple things, thanks for the help. Sadly I am still getting errors, but later on now:
Wasn't able to fully decrypt this. Do you have any idea what could be going on here? |
|
Yeah that was a part of why I was confused, I probably I should have explained more. the bit.bor field definetly works. It also never actually hits that part of the code when running, it seems the error function (?) is trying to post-hoc figure out what could be wrong (?). If I just comment out the line local s = debug.traceback(thread, (...))
s = s:gsub('stack traceback:', tostring(thread)..' stack traceback:')
error(s, 2) If I force an error (
(Also if useful this is the initial code I am using to test: local mysql = require'mysql'
local sock = require'sock'
sock.run(function()
local conn = assert(mysql.connect{
host = '127.0.0.1',
port = 13306,
user = 'root',
db = 'tser',
charset = 'utf8mb4',
collation = 'utf8mb4_unicode_ci'
})
conn.close()
end) I also get the same error using |
Hello, I am trying to run this code on LuaJIT version 2.0.0-beta 10. I am having toruble as parameterized types were only added to LuaJIT in version 2.0.1. They are used here:
local cbuf = ffi.new(ffi.typeof('$[1]', ffi.typeof(func_ct)))
and here:local overlapped_ptr_ct = ffi.typeof('$ *', overlapped_ct)
. I was wodnering if you knew any way of getting around using parameterized types here? Thanks!The text was updated successfully, but these errors were encountered: