summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/hashserv/__init__.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2020-11-10 08:59:55 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-11-24 15:26:12 +0000
commit859f43e176dcaaa652e24a2289abd75e18c077cf (patch)
treeb515cd85fddd9ef20ad77ba0e6e2a340d6e1c517 /bitbake/lib/hashserv/__init__.py
parent451af0105bc934c6be239a79821193139e49ab1a (diff)
downloadpoky-859f43e176dcaaa652e24a2289abd75e18c077cf.tar.gz
bitbake: bitbake: hashserve: Add async client
Adds support for create a client that operates using Python asynchronous I/O. (Bitbake rev: cf9bc0310b0092bf52b61057405aeb51c86ba137) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/hashserv/__init__.py')
-rw-r--r--bitbake/lib/hashserv/__init__.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/lib/hashserv/__init__.py b/bitbake/lib/hashserv/__init__.py
index f95e8f43f1..622ca17a91 100644
--- a/bitbake/lib/hashserv/__init__.py
+++ b/bitbake/lib/hashserv/__init__.py
@@ -3,6 +3,7 @@
3# SPDX-License-Identifier: GPL-2.0-only 3# SPDX-License-Identifier: GPL-2.0-only
4# 4#
5 5
6import asyncio
6from contextlib import closing 7from contextlib import closing
7import re 8import re
8import sqlite3 9import sqlite3
@@ -113,3 +114,15 @@ def create_client(addr):
113 c.connect_tcp(*a) 114 c.connect_tcp(*a)
114 115
115 return c 116 return c
117
118async def create_async_client(addr):
119 from . import client
120 c = client.AsyncClient()
121
122 (typ, a) = parse_address(addr)
123 if typ == ADDR_TYPE_UNIX:
124 await c.connect_unix(*a)
125 else:
126 await c.connect_tcp(*a)
127
128 return c