Use turbo looper on Android

pull/1509/head
chrox 9 years ago
parent dfe39589f4
commit d468b05567

@ -1 +1 @@
Subproject commit 1da8201942114d5dce312b0511bb75c8465683b2
Subproject commit 47d27ae195d3d0bdd538c276c1c2ae1c88bd28f7

@ -24,7 +24,7 @@ function HTTPClient:request(request, response_callback)
-- disable success and warning logs
turbo.log.categories.success = false
turbo.log.categories.warning = false
local client = turbo.async.HTTPClient({verify_ca = "none"})
local client = turbo.async.HTTPClient({verify_ca = false})
local res = coroutine.yield(client:fetch(request.url, request))
self.input_timeouts = self.input_timeouts - 1
-- reset INPUT_TIMEOUT to nil when all HTTP requests are fullfilled.

@ -523,8 +523,9 @@ function UIManager:handleInput()
end
function UIManager:initLooper()
if not self.looper and not Device.isAndroid() and ffi.os ~= "Windows" then
if not self.looper and ffi.os ~= "Windows" then
TURBO_SSL = true
__TURBO_USE_LUASOCKET__ = true
local turbo = require("turbo")
self.looper = turbo.ioloop.instance()
end
@ -536,7 +537,7 @@ end
function UIManager:run()
self._running = true
self:initLooper()
-- currently there is no Turbo support for Android and Windows
-- currently there is no Turbo support for Windows
-- use our own main loop
if not self.looper then
while self._running do

@ -18,6 +18,9 @@ describe("HTTP client module", function()
local urls = {
"http://www.example.com",
"http://www.example.org",
"http://www.example.net",
"https://www.example.com",
"https://www.example.org",
}
requests = #urls
for _, url in ipairs(urls) do

Loading…
Cancel
Save