summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Bronder <jsbronder@cold-front.org>2022-11-09 04:29:35 -1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-11-10 14:43:24 +0000
commit4bdd9ba43f34a1473db31a6a3b10bd33e358fe3a (patch)
treecfbb147c4262912003367768984fd87f8fb1a51f
parent13f86aeb53cd73c03bfb2f00fe923b51ec8d1c73 (diff)
downloadbitbake-4bdd9ba43f34a1473db31a6a3b10bd33e358fe3a.tar.gz
asyncrpc: serv: correct closed client socket detection
If the client socket is closed, asyncio.StreamReader.readline() will return an empty bytes object, not None. This prevents multiple tracebacks being logged by bitbake-hashserv each time bitbake is started and performs a connection check. Signed-off-by: Justin Bronder <jsbronder@cold-front.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 2d07f252704dff7747fa1f9adf223a452806717f) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/asyncrpc/serv.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/bb/asyncrpc/serv.py b/lib/bb/asyncrpc/serv.py
index 5cf45f908..d2de4891b 100644
--- a/lib/bb/asyncrpc/serv.py
+++ b/lib/bb/asyncrpc/serv.py
@@ -42,7 +42,7 @@ class AsyncServerConnection(object):
# Read protocol and version
client_protocol = await self.reader.readline()
- if client_protocol is None:
+ if not client_protocol:
return
(client_proto_name, client_proto_version) = client_protocol.decode('utf-8').rstrip().split()
@@ -59,7 +59,7 @@ class AsyncServerConnection(object):
# an empty line to signal the end of the headers
while True:
line = await self.reader.readline()
- if line is None:
+ if not line:
return
line = line.decode('utf-8').rstrip()