mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
bitbake: 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. (Bitbake rev: 2d07f252704dff7747fa1f9adf223a452806717f) 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>
This commit is contained in:
committed by
Richard Purdie
parent
eff3042f0e
commit
6ca9f04b8e
@@ -42,7 +42,7 @@ class AsyncServerConnection(object):
|
|||||||
|
|
||||||
# Read protocol and version
|
# Read protocol and version
|
||||||
client_protocol = await self.reader.readline()
|
client_protocol = await self.reader.readline()
|
||||||
if client_protocol is None:
|
if not client_protocol:
|
||||||
return
|
return
|
||||||
|
|
||||||
(client_proto_name, client_proto_version) = client_protocol.decode('utf-8').rstrip().split()
|
(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
|
# an empty line to signal the end of the headers
|
||||||
while True:
|
while True:
|
||||||
line = await self.reader.readline()
|
line = await self.reader.readline()
|
||||||
if line is None:
|
if not line:
|
||||||
return
|
return
|
||||||
|
|
||||||
line = line.decode('utf-8').rstrip()
|
line = line.decode('utf-8').rstrip()
|
||||||
|
|||||||
Reference in New Issue
Block a user