Compression packing fix

This commit is contained in:
Emily 2019-08-01 19:04:07 +02:00
parent 9c2cbb1921
commit dc98b5e6d5

View File

@ -12,7 +12,7 @@ clients = set()
STRUCTS = {
"start": b"fHB%ds",
"end": b"",
"flight_data": b"2BHhH3f",
"flight_data": b"BBHhHfff",
"server_open": b"",
"server_close": b""
}
@ -134,7 +134,7 @@ async def handle(ws, path):
await subscribe_flight(struct.pack(b"<I?", int(path), True))
while not cli.ws.closed:
async for data in cli.ws:
data = data.encode() # For some reason or another... websockets module returns a string instead of bytes?
#data = data.encode() # For some reason or another... websockets module returns a string instead of bytes?
await query(data)
await asyncio.sleep(.1)
@ -164,7 +164,7 @@ class Flight:
asyncio.ensure_future( broadcast_flight_change(self.uuid, self.active) )
def get_head(self):
return struct.pack(b"<I" + STRUCTS["start"],
return struct.pack(b"<I" + STRUCTS["start"] % self.playername_len,
self.uuid,
self.max_fuel,
self.model_id,