Fix set udp sock

This commit is contained in:
Maxim Khomutov 2023-07-18 22:59:12 +03:00
parent 407127ec97
commit 852e977a75

View File

@ -30,9 +30,10 @@ class UDPServer(asyncio.DatagramTransport):
code = data[2:3].decode() code = data[2:3].decode()
client = self.Core.get_client(cid=cid) client = self.Core.get_client(cid=cid)
if client and client._udp_sock != (self.transport, addr): if client:
client._udp_sock = (self.transport, addr) if client._udp_sock != (self.transport, addr):
self.log.debug(f"Set UDP Sock for CID: {cid}") client._udp_sock = (self.transport, addr)
self.log.debug(f"Set UDP Sock for CID: {cid}")
else: else:
self.log.debug(f"Client not found.") self.log.debug(f"Client not found.")
@ -42,7 +43,8 @@ class UDPServer(asyncio.DatagramTransport):
# TODO: Call event onSentPing # TODO: Call event onSentPing
self.transport.sendto(b"p", addr) # Send ping self.transport.sendto(b"p", addr) # Send ping
case "Z": case "Z":
# TODO: Positions synchronization if client:
client._send(data)
# TODO: Call event onChangePosition # TODO: Call event onChangePosition
pass pass
case _: case _: