Compression packing fix
This commit is contained in:
parent
9c2cbb1921
commit
dc98b5e6d5
|
@ -12,7 +12,7 @@ clients = set()
|
||||||
STRUCTS = {
|
STRUCTS = {
|
||||||
"start": b"fHB%ds",
|
"start": b"fHB%ds",
|
||||||
"end": b"",
|
"end": b"",
|
||||||
"flight_data": b"2BHhH3f",
|
"flight_data": b"BBHhHfff",
|
||||||
"server_open": b"",
|
"server_open": b"",
|
||||||
"server_close": b""
|
"server_close": b""
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ async def handle(ws, path):
|
||||||
await subscribe_flight(struct.pack(b"<I?", int(path), True))
|
await subscribe_flight(struct.pack(b"<I?", int(path), True))
|
||||||
while not cli.ws.closed:
|
while not cli.ws.closed:
|
||||||
async for data in cli.ws:
|
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 query(data)
|
||||||
|
|
||||||
await asyncio.sleep(.1)
|
await asyncio.sleep(.1)
|
||||||
|
@ -164,7 +164,7 @@ class Flight:
|
||||||
asyncio.ensure_future( broadcast_flight_change(self.uuid, self.active) )
|
asyncio.ensure_future( broadcast_flight_change(self.uuid, self.active) )
|
||||||
|
|
||||||
def get_head(self):
|
def get_head(self):
|
||||||
return struct.pack(b"<I" + STRUCTS["start"],
|
return struct.pack(b"<I" + STRUCTS["start"] % self.playername_len,
|
||||||
self.uuid,
|
self.uuid,
|
||||||
self.max_fuel,
|
self.max_fuel,
|
||||||
self.model_id,
|
self.model_id,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user