Add more logging on msg passing

pull/2/head
Guillermo Rodriguez 2022-12-24 11:34:00 -03:00
parent 55781688cd
commit 2b0ed25605
No known key found for this signature in database
GPG Key ID: EC3AB66D5D83B392
2 changed files with 10 additions and 6 deletions

View File

@ -117,9 +117,9 @@ async def open_rpc_service(sock, dgpu_bus, db_pool, tls_whitelist, tls_key):
async def dgpu_image_streamer():
nonlocal wip_reqs, fin_reqs
while True:
msg = DGPUBusResponse(
**json.loads(
(await dgpu_bus.arecv()).decode()))
raw_msg = (await dgpu_bus.arecv()).decode()
logging.info(f'streamer got {len(raw_msg)} bytes.')
msg = DGPUBusResponse(**json.loads(raw_msg))
if security:
msg.verify(tls_whitelist[msg.cert])

View File

@ -119,8 +119,9 @@ async def open_dgpu_node(
if ireq.upscaler == 'x4':
logging.info('performing upscale...')
input_img = image.convert('RGB')
up_img, _ = upscaler.enhance(
convert_from_image_to_cv2(image), outscale=4)
convert_from_image_to_cv2(input_img), outscale=4)
image = convert_from_cv2_to_image(up_img)
logging.info('done')
@ -238,9 +239,12 @@ async def open_dgpu_node(
if security:
img_resp.sign(tls_key, cert_name)
raw_msg = json.dumps(img_resp.to_dict()).encode()
# send final image
await dgpu_sock.asend(
json.dumps(img_resp.to_dict()).encode())
logging.info('sending img back...')
await dgpu_sock.asend(raw_msg)
logging.info(f'sent {len(raw_msg)} bytes.')
except KeyboardInterrupt:
logging.info('interrupt caught, stopping...')