From d468b055674ceffe95c3d4bae830ed52a107337c Mon Sep 17 00:00:00 2001 From: chrox Date: Tue, 28 Apr 2015 11:06:00 +0800 Subject: [PATCH] Use turbo looper on Android --- base | 2 +- frontend/httpclient.lua | 2 +- frontend/ui/uimanager.lua | 5 +++-- spec/unit/httpclient_spec.lua | 3 +++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/base b/base index 1da820194..47d27ae19 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 1da8201942114d5dce312b0511bb75c8465683b2 +Subproject commit 47d27ae195d3d0bdd538c276c1c2ae1c88bd28f7 diff --git a/frontend/httpclient.lua b/frontend/httpclient.lua index cd9bf1831..56458a400 100644 --- a/frontend/httpclient.lua +++ b/frontend/httpclient.lua @@ -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. diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 91b2a4816..6963420d0 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -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 diff --git a/spec/unit/httpclient_spec.lua b/spec/unit/httpclient_spec.lua index f31ef2bf4..9aa725bb8 100644 --- a/spec/unit/httpclient_spec.lua +++ b/spec/unit/httpclient_spec.lua @@ -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