rumblefrog / a2s-rs

Rust implementation of Source Query
MIT License
20 stars 14 forks source link

Fix processing of multi-packet responses #16

Closed MegaBrutal closed 1 year ago

MegaBrutal commented 1 year ago

I noticed that queries to some servers mysteriously fail for some reason. I digged into it and found that the library can't process multi-packet responses. When I got into fixing it, it actually created a snowball effect which resulted in changing quite a few things. I added constants and a macro to read offsets, then the changes needed to be ported into the async code, which induced me to write async tests. Also the async code didn't work because it mixed up replies for multiple requests as it used the same UdpSocket.

BZ2 decompression was not tested because I couldn't find any servers those reply with BZ2-compressed packets.

I suggest you to test with any servers you know to make sure there are no regressions.