chatterino2
chatterino2 copied to clipboard
Introduce HTTP API for plugins
This adds a new API: c2.HTTPRequest
that requires a new permission: Network
.
The crash happens in the handlers of the request. Looking at the captured L, it's probably the thread from c2.later getting deleted while the callbacks hold on to it through lua_State.
I'll have to store an ID of the plugin or something and get the state back then.
The following code segfaults after a short while:
local function send_req() local req = c2.HTTPRequest.create(c2.HTTPMethod.Get, "https://postman-echo.com/get") req:on_success(function(res) end) req:on_error(function(result) end) req:execute() c2.later(send_req, 100) end send_req()
The crash happens in the handlers of the request. Looking at the captured
L
, it's probably the thread fromc2.later
getting deleted while the callbacks hold on to it throughlua_State
.
Weird that this only happens with hosts that are remote that is have some latency. Seems like a pesky race condition.
Let me know when it's in a finished state and I'll take a look