mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-11 18:58:59 +03:00
more ws message type awareness in the deamon (#15797)
This commit is contained in:
parent
d3f2dfaa1e
commit
1c5b469c5b
@ -288,12 +288,23 @@ class WebSocketServer:
|
||||
if len(service_names) == 0:
|
||||
service_names = ["Unknown"]
|
||||
|
||||
if msg.type == WSMsgType.CLOSE:
|
||||
self.log.info(f"ConnectionClosed. Closing websocket with {service_names}")
|
||||
closing_message = f"Closing websocket with {service_names}."
|
||||
|
||||
level = logging.INFO
|
||||
if msg.type == WSMsgType.CLOSED:
|
||||
message = f"Connection closed. {closing_message}"
|
||||
elif msg.type == WSMsgType.CLOSING:
|
||||
message = f"Connection closing. {closing_message}"
|
||||
elif msg.type == WSMsgType.CLOSE:
|
||||
message = f"Connection close requested. {closing_message}"
|
||||
elif msg.type == WSMsgType.ERROR:
|
||||
self.log.info(f"Websocket exception. Closing websocket with {service_names}. {ws.exception()}")
|
||||
level = logging.ERROR
|
||||
message = f"Websocket exception. {closing_message} {ws.exception()}"
|
||||
else:
|
||||
self.log.info(f"Unexpected message type. Closing websocket with {service_names}. {msg.type}")
|
||||
level = logging.ERROR
|
||||
message = f"Unexpected message type. {closing_message} {msg.type}"
|
||||
|
||||
self.log.log(level=level, msg=message)
|
||||
|
||||
await ws.close()
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user