aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hashserv/client.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2020-12-02 13:58:10 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-12-03 23:09:46 +0000
commit53e85022a8b1c8f407c9418260c59beffb96f0f9 (patch)
tree617c4f7e6f695aca8f3a391f2ad8008ed5e8ff9f /lib/hashserv/client.py
parent22b8c53205f8915b33d1e0ad6a666dcacc01491d (diff)
downloadbitbake-53e85022a8b1c8f407c9418260c59beffb96f0f9.tar.gz
hashserv: client: Fix AF_UNIX path length limits
Restores a fix for unix domain socket path length limits when using the synchronous hash equivalence client that was accidentally removed when the async client was added. Unfortunately, it's much more difficult to fix the same problem when using the async client directly due to the interaction of chdir() and async code, but this will at least restore the old behavior in the synchronous case. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/hashserv/client.py')
-rw-r--r--lib/hashserv/client.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/hashserv/client.py b/lib/hashserv/client.py
index ae5875d1b..7bbf0865d 100644
--- a/lib/hashserv/client.py
+++ b/lib/hashserv/client.py
@@ -40,7 +40,7 @@ class AsyncClient(object):
self._connect_sock = connect_sock
- async def _connect(self):
+ async def connect(self):
if self.reader is None or self.writer is None:
(self.reader, self.writer) = await self._connect_sock()
@@ -62,7 +62,7 @@ class AsyncClient(object):
count = 0
while True:
try:
- await self._connect()
+ await self.connect()
return await proc()
except (
OSError,
@@ -190,7 +190,6 @@ class Client(object):
for call in (
"connect_tcp",
- "connect_unix",
"close",
"get_unihash",
"report_unihash",
@@ -209,6 +208,16 @@ class Client(object):
return wrapper
+ def connect_unix(self, path):
+ # AF_UNIX has path length issues so chdir here to workaround
+ cwd = os.getcwd()
+ try:
+ os.chdir(os.path.dirname(path))
+ self.loop.run_until_complete(self.client.connect_unix(path))
+ self.loop.run_until_complete(self.client.connect())
+ finally:
+ os.chdir(cwd)
+
@property
def max_chunk(self):
return self.client.max_chunk