summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-11 22:43:28 +0800
committerruki <[email protected]>2024-09-11 22:43:28 +0800
commitf8893fca1ea3ad3c75a8491e65cad98d7312dc42 (patch)
tree320d2d4a2758733fb8208642d71fe4e051bf7777
parentc69ee0dfdb7110cf6b62f4e4cbeabe59eb5ef99b (diff)
fix distcc #4760
-rw-r--r--xmake/modules/private/service/distcc_build/client.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/xmake/modules/private/service/distcc_build/client.lua b/xmake/modules/private/service/distcc_build/client.lua
index ae3d47ec7..696d533ce 100644
--- a/xmake/modules/private/service/distcc_build/client.lua
+++ b/xmake/modules/private/service/distcc_build/client.lua
@@ -175,7 +175,7 @@ function distcc_build_client:maxjobs()
if maxjobs == nil then
maxjobs = 0
for _, host in pairs(self:status().hosts) do
- maxjobs = maxjobs + host.njob
+ maxjobs = maxjobs + (host.njob or 4)
end
self._MAXJOBS = maxjobs
end
@@ -569,13 +569,15 @@ function distcc_build_client:_connect_host(host)
end
-- update status
- local status = self:status()
- status.hosts = status.hosts or {}
- status.hosts[addr .. ":" .. port] = {
- addr = addr, port = port, token = token,
- connected = ok, session_id = session_id,
- ncpu = ncpu, njob = host.njob or njob}
- self:status_save()
+ if ok then
+ local status = self:status()
+ status.hosts = status.hosts or {}
+ status.hosts[addr .. ":" .. port] = {
+ addr = addr, port = port, token = token,
+ connected = ok, session_id = session_id,
+ ncpu = ncpu, njob = njob}
+ self:status_save()
+ end
end
-- disconnect from the host