diff options
| author | Joshua Watt <JPEWhacker@gmail.com> | 2020-11-10 08:59:55 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-11-24 15:26:12 +0000 |
| commit | 859f43e176dcaaa652e24a2289abd75e18c077cf (patch) | |
| tree | b515cd85fddd9ef20ad77ba0e6e2a340d6e1c517 /bitbake/lib/hashserv/__init__.py | |
| parent | 451af0105bc934c6be239a79821193139e49ab1a (diff) | |
| download | poky-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__.py | 13 |
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 | ||
| 6 | import asyncio | ||
| 6 | from contextlib import closing | 7 | from contextlib import closing |
| 7 | import re | 8 | import re |
| 8 | import sqlite3 | 9 | import 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 | |||
| 118 | async 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 | ||
