Use turbo looper on Android

This commit is contained in:
chrox
2015-04-28 11:06:00 +08:00
parent dfe39589f4
commit d468b05567
4 changed files with 8 additions and 4 deletions

2
base

Submodule base updated: 1da8201942...47d27ae195

View File

@@ -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.

View File

@@ -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

View File

@@ -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