diff options
| author | ruki <[email protected]> | 2022-05-12 23:51:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-05-12 23:51:22 +0800 |
| commit | 9287baf136e9c347da35d27cd7c6c1c1c54b89a2 (patch) | |
| tree | 5df72e07f30a956dfa4eade00a52b57234b6ce2b /xmake/modules/private/service/client.lua | |
| parent | 9442ba64fb5eb2e272a45c850376e4296ebfb761 (diff) | |
improve distcc config
Diffstat (limited to 'xmake/modules/private/service/client.lua')
| -rw-r--r-- | xmake/modules/private/service/client.lua | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/xmake/modules/private/service/client.lua b/xmake/modules/private/service/client.lua index 5a91ab1e8..437a10f8a 100644 --- a/xmake/modules/private/service/client.lua +++ b/xmake/modules/private/service/client.lua @@ -30,40 +30,26 @@ local client = client or object() function client:init() end --- set the given client address -function client:address_set(address) +-- parse host address +function client:address_parse(address) + local addr, port, user local splitinfo = address:split(':', {plain = true}) if #splitinfo == 2 then - self._ADDR = splitinfo[1] - self._PORT = splitinfo[2] + addr = splitinfo[1] + port = splitinfo[2] else - self._ADDR = "127.0.0.1" - self._PORT = splitinfo[1] + addr = "127.0.0.1" + port = splitinfo[1] end - local addr = self._ADDR if addr and addr:find("@", 1, true) then splitinfo = addr:split('@', {plain = true}) if #splitinfo == 2 then - self._USER = splitinfo[1] - self._ADDR = splitinfo[2] + user = splitinfo[1] + addr = splitinfo[2] end end - assert(self._ADDR and self._PORT, "invalid client address!") -end - --- get user name -function client:user() - return self._USER -end - --- get the ip address -function client:addr() - return self._ADDR -end - --- get the address port -function client:port() - return self._PORT + assert(addr and port, "invalid client address!") + return addr, port, user end -- get class |
