marceldev89 / BattleNET

BattlEye Protocol Library and Client
GNU Lesser General Public License v3.0
75 stars 44 forks source link

BattleNET is unable to request big ban lists #1

Closed DomiStyle closed 12 years ago

DomiStyle commented 12 years ago

There appears to be a problem when requesting big ban lists via BattleNET. An example would be the community ban list: http://code.google.com/p/dayz-community-banlist/source/browse/bans/bans.txt You either get no response at all or just cut off lists causing problems when parsing.

marceldev89 commented 12 years ago

Will take a look soon when the weather cools down. Haven't sat at my desktop for days. Thanks for reporting though.

-----Oorspronkelijk bericht----- Van: DomiStyle Verzonden: 19-8-2012 23:46 Aan: ziellos2k/BattleNET Onderwerp: [BattleNET] BattleNET is unable to request big ban lists (#1)

There appears to be a problem when requesting big ban lists via BattleNET. An example would be the community ban list: http://code.google.com/p/dayz-community-banlist/source/browse/bans/bans.txt You either get no response at all or just cut off lists causing problems when parsing.

— Reply to this email directly or view it on GitHub.

DomiStyle commented 12 years ago

To be more exact: After 62465 symbols it is cut off, ending up in the middle of IP Ban #100 something on the community ban list. Thank you.

marceldev89 commented 12 years ago

There doesn't seem to be a problem code wise. It could possibly be a problem on the side of BattlEye.

DomiStyle commented 12 years ago

It works fine in BERCon. Maybe BattlEye splits the packages when it reaches this size? Since it always cuts off there it would make sense.

marceldev89 commented 12 years ago

The code already handles multiple packets per message. I'll load up the ban list on my server and check what actually happens. :)

marceldev89 commented 12 years ago

Should be fixed now, somewhat. ;-)

DomiStyle commented 12 years ago

It still ends for me on IP ban #191, any idea? edit: Actually it always ends on a different IP ban around #191 so I guess it's not a buffer problem?

marceldev89 commented 12 years ago

Can you send me the specific bans.txt file you're using?

marceldev89 commented 12 years ago

http://code.google.com/p/dayz-community-banlist/source/browse/bans/bans.txt works fine for me now. Both in DaRT (with updated .dll) and my own client.

DomiStyle commented 12 years ago

Yes, it works now. There seems to be a problem with DaRT getting the ban list twice now though, will figure it out now.

edit: It seems to be a timing issue now. I usually waited for 1 second and checked if the request is null. This doesn't work with a big ban list. Is there a way for me to wait for the request? I atleast added a timeout now so the thread doesn't start to loop infinite.

marceldev89 commented 12 years ago

There's no real method to check whether a request is done. Basically what it does is fire the 'MessageReceivedEvent' event, containing the data received from BattlEye, when it has received all expected packets (lines 342-369).

It is possible that while you request the ban list, BattlEye sends a server message (i.e. "XXXXXXX connected", etc) at the same time which would somehow screw things up.

One thing you can try to at least solve the infinite loop is inserting the following at line 367 in BattlEyeClient.cs before the OnMessageReceived() method: buffer = null; bufferCount = 0; packetCount = 0;

If that solves it (the infinite loop) somewhat I'll add it to the code as well.

To fully solve the timing / race condition problem we'd probably have to implement some sort of request / response queuing system. I'll add it to my 'near future' list. ;-)

DomiStyle commented 12 years ago

Yes, I handle it with the MessageReceivedEvent and to some filtering there. So I can split up players, bans and log.

I already fixed the infinite loop. However, big ban lists still don't work. I always get the list twice cause DaRT automatically requests it again if there was no answer after 1 second. This ends in having the ban list 2 times. I may include a messy fix later which will just detect if the list starts over and aborts. Will test this with an even bigger ban list later.

Atleast it is not split anymore, so that is fixed. Thank you.