@@ -278,7 +278,8 @@ async def __receive(self, udpClient: UdpClient) -> bytes:
278278
279279 # Packet id
280280 id = br .read_long ()
281- is_compressed = (id & 0x80000000 ) < 0
281+ is_compressed = id & 0x80000000 != 0
282+ print (is_compressed )
282283
283284 # Check is GoldSource multi-packet response format
284285 if self .__is_gold_source_split (BinaryReader (br .read ())):
@@ -290,15 +291,15 @@ async def __receive(self, udpClient: UdpClient) -> bytes:
290291 # The number of the packet
291292 number = br .read_byte ()
292293
293- # Packet size
294- br .read_short ()
295-
296294 if number == 0 and is_compressed :
297295 # Decompressed size
298- br .read_long ()
296+ br .read_long (unsigned = True )
299297
300298 # CRC32 sum
301- crc32_checksum = br .read_long ()
299+ crc32_checksum = br .read_long (unsigned = True )
300+ else :
301+ # Packet size
302+ br .read_short ()
302303
303304 payloads [number ] = br .read ()
304305
@@ -377,13 +378,13 @@ async def __parse_gold_source_packet(self, udpClient: UdpClient, packets: list):
377378 import asyncio
378379
379380 async def main_async ():
380- source = Source (host = "45.62.160.71 " , port = 27015 , timeout = 5.0 )
381- info = await source .get_info ()
382- print (info )
381+ source = Source (host = "146.19.87.161 " , port = 27015 , timeout = 5.0 )
382+ # info = await source.get_info()
383+ # print(info)
383384
384- await asyncio .sleep (1 )
385- players = await source .get_players ()
386- print (players )
385+ # await asyncio.sleep(1)
386+ # players = await source.get_players()
387+ # print(players)
387388
388389 await asyncio .sleep (1 )
389390 rules = await source .get_rules ()
0 commit comments