LADX: catch exception after closing magpie #5687

This commit is contained in:
threeandthreee
2025-11-29 12:46:22 -05:00
committed by GitHub
parent 8a1a715dc4
commit a07faca2d9

View File

@@ -195,21 +195,24 @@ class MagpieBridge:
async def handler(self, websocket): async def handler(self, websocket):
self.ws = websocket self.ws = websocket
while True: while True:
message = json.loads(await websocket.recv()) try:
if message["type"] == "handshake": message = json.loads(await websocket.recv())
logger.info( if message["type"] == "handshake":
f"Connected, supported features: {message['features']}") logger.info(
self.features = message["features"] f"Connected, supported features: {message['features']}")
self.features = message["features"]
await self.send_handshAck() await self.send_handshAck()
if message["type"] == "sendFull": if message["type"] == "sendFull":
if "items" in self.features: if "items" in self.features:
await self.send_all_inventory() await self.send_all_inventory()
if "checks" in self.features: if "checks" in self.features:
await self.send_all_checks() await self.send_all_checks()
if self.use_entrance_tracker(): if self.use_entrance_tracker():
await self.send_gps(diff=False) await self.send_gps(diff=False)
except websockets.exceptions.ConnectionClosedOK:
pass
# Translate renamed IDs back to LADXR IDs # Translate renamed IDs back to LADXR IDs
@staticmethod @staticmethod