mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Use turbo looper on Android
This commit is contained in:
2
base
2
base
Submodule base updated: 1da8201942...47d27ae195
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user