From c7cac7b33386218f84fb108de214228e4c4747df Mon Sep 17 00:00:00 2001 From: chrox Date: Tue, 2 Jun 2015 13:07:17 +0800 Subject: [PATCH 1/2] disable turbo lib by default --- base | 2 +- defaults.lua | 4 ++++ frontend/ui/uimanager.lua | 2 +- spec/unit/httpclient_spec.lua | 6 ++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/base b/base index 6edadeb61..cd68f482e 160000 --- a/base +++ b/base @@ -1 +1 @@ -Subproject commit 6edadeb61b0daa85da8ceb4f113f59405eb4333e +Subproject commit cd68f482e00f26402ea8116ef813df08162a39cb diff --git a/defaults.lua b/defaults.lua index 8ab103cd1..210cc6c1a 100644 --- a/defaults.lua +++ b/defaults.lua @@ -182,6 +182,10 @@ KOBO_SCREEN_SAVER_LAST_BOOK = true -- get screensaver from last book if possible -- proxy authentication is not supported yet. NETWORK_PROXY = nil +-- Experimental features +-- Use turbo library to handle async HTTP request +DUSE_TURBO_LIB = false + -- #################################################################### -- following features are not supported right now -- #################################################################### diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 6963420d0..6ac406710 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -523,7 +523,7 @@ function UIManager:handleInput() end function UIManager:initLooper() - if not self.looper and ffi.os ~= "Windows" then + if DUSE_TURBO_LIB and not self.looper then TURBO_SSL = true __TURBO_USE_LUASOCKET__ = true local turbo = require("turbo") diff --git a/spec/unit/httpclient_spec.lua b/spec/unit/httpclient_spec.lua index 9aa725bb8..4972ac640 100644 --- a/spec/unit/httpclient_spec.lua +++ b/spec/unit/httpclient_spec.lua @@ -12,6 +12,12 @@ describe("HTTP client module", function() assert(not res.error, "error occurs") assert(res.body) end + setup(function() + DUSE_TURBO_LIB = true + end) + teardown(function() + DUSE_TURBO_LIB = false + end) local async_client = HTTPClient:new() it("should get response from async GET request", function() UIManager:quit() From a59621953d159a6aeee4f1f483c0d742180445f3 Mon Sep 17 00:00:00 2001 From: chrox Date: Tue, 2 Jun 2015 21:23:30 +0800 Subject: [PATCH 2/2] use turbo library in coverage test --- spec/unit/commonrequire.lua | 3 +++ spec/unit/httpclient_spec.lua | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/spec/unit/commonrequire.lua b/spec/unit/commonrequire.lua index 2e0f49531..1f7e6260d 100644 --- a/spec/unit/commonrequire.lua +++ b/spec/unit/commonrequire.lua @@ -21,3 +21,6 @@ Input.dummy = true -- turn on debug local DEBUG = require("dbg") --DEBUG:turnOn() + +-- use turbo lib in test +DUSE_TURBO_LIB = true diff --git a/spec/unit/httpclient_spec.lua b/spec/unit/httpclient_spec.lua index 4972ac640..9aa725bb8 100644 --- a/spec/unit/httpclient_spec.lua +++ b/spec/unit/httpclient_spec.lua @@ -12,12 +12,6 @@ describe("HTTP client module", function() assert(not res.error, "error occurs") assert(res.body) end - setup(function() - DUSE_TURBO_LIB = true - end) - teardown(function() - DUSE_TURBO_LIB = false - end) local async_client = HTTPClient:new() it("should get response from async GET request", function() UIManager:quit()