summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-15 12:28:40 +0800
committerruki <[email protected]>2022-05-15 12:28:40 +0800
commit14148b3694a1e0a994c2f66d18b0c3f256e0c425 (patch)
tree69d574dc4c355374d0766924d9a3f5a81c893ea4
parent998db83357fed76073b8ccd77c68d82db5b52946 (diff)
check opened session
-rw-r--r--xmake/modules/private/service/distcc_build/client.lua6
-rw-r--r--xmake/modules/private/service/distcc_build/client_session.lua17
2 files changed, 23 insertions, 0 deletions
diff --git a/xmake/modules/private/service/distcc_build/client.lua b/xmake/modules/private/service/distcc_build/client.lua
index c9377f8b8..c6e4042ff 100644
--- a/xmake/modules/private/service/distcc_build/client.lua
+++ b/xmake/modules/private/service/distcc_build/client.lua
@@ -212,9 +212,15 @@ function distcc_build_client:iorunv(program, argv, opt)
-- get the host session
local session = self:_host_status_session(host)
+ -- open session
+ session:open()
+
-- do distcc compilation
local outdata, errdata = session:iorunv(program, argv, opt)
+ -- close session
+ session:close()
+
-- unlock this host
self:_host_status_unlock(host)
return outdata, errdata
diff --git a/xmake/modules/private/service/distcc_build/client_session.lua b/xmake/modules/private/service/distcc_build/client_session.lua
index e01772859..749fe9389 100644
--- a/xmake/modules/private/service/distcc_build/client_session.lua
+++ b/xmake/modules/private/service/distcc_build/client_session.lua
@@ -61,8 +61,25 @@ function client_session:stream()
return self._STREAM
end
+-- open session
+function client_session:open()
+ assert(not self:is_opened(), "%s: has been opened!", self)
+ self._OPENED = true
+end
+
+-- close session
+function client_session:close()
+ self._OPENED = false
+end
+
+-- is opened?
+function client_session:is_opened()
+ return self._OPENED
+end
+
-- run compilation job
function client_session:iorunv(program, argv, opt)
+ assert(self:is_opened(), "%s: has been not opened!", self)
opt = opt or {}
local toolname = opt.toolname
local iorunv = assert(self["_" .. toolname .. "_iorunv"], "%s: iorunv(%s) is not supported!", self, program)