TheLastRefuge / Jarcon

🌐 Java remote console client for Battlefield servers
0 stars 0 forks source link

Server info parsing #16

Open chris6366 opened 3 years ago

chris6366 commented 3 years ago

Before the server (supposedly) gets to know its IP and port from Blaze, the IP/port combination is an empty string in the server info response. Hence the if(ipPortPair.isBlank()) return null; below:

https://github.com/TheLastRefuge/Jarcon/blob/9599dda3151dc511769f28f36128d99689e42a96/src/main/java/gg/tlr/jarcon/Util.java#L53-L57

Same holds for the team scores. If the server isn't fully started up yet, they're missing from the server info response. Hence the if(buffer.size() == 20) return null; below:

https://github.com/TheLastRefuge/Jarcon/blob/9599dda3151dc511769f28f36128d99689e42a96/src/main/java/gg/tlr/jarcon/frostbite/TeamScore.java#L13-L29

These were just hotfixes. A better solution is welcome.

ItsFlare commented 8 months ago

Included in 31823f2fd8b72a89b86a14a7ca5abd2fd0c8d49a. How does the 20 word magic number come to be? Are you sure this is the only case it may occur in?

chris6366 commented 8 months ago

I simply found out that after a server restart the first or first few team score packets are 20 chars long, just because they were causing runtime exceptions. I don't remember checking out the contents.

I don't know for sure if it's the only case, other data might be missing too after a server restart.