BigBrotherBot / big-brother-bot

Big Brother Bot B3 is a complete and total server administration package for online games. B3 is designed primarily to keep your server free from the derelicts of online gaming, but offers more, much more.
http://www.bigbrotherbot.net
148 stars 143 forks source link

client auth event is different for frostbite parsers #245

Closed danielepantaleone closed 9 years ago

danielepantaleone commented 9 years ago

As far as I understood, frostbite parsers use EVT_PUNKBUSTER_NEW_CONNECTION instead of EVT_CLIENT_AUTH but they actually match the very same event: in EVT_CLIENT_CONNECT the client is not authed, but in EVT_PUNKBUSTER_NEW_CONNECTION or EVT_CLIENT_AUTH the client is authed. Wouldn't it be better to use just 1 event? Otherwise in plugins we would need to handle this situation (we are already doing it).

thomasleveil commented 9 years ago

frostbite parsers use EVT_PUNKBUSTER_NEW_CONNECTION

Frostbite parsers fire the EVT_PUNKBUSTER_NEW_CONNECTION whenever they receive the matching event from the Frostbite game engine. This event bring valuable data such as the player's IP address. We cannot guess what useful use a plugin developer could come up with based on that event, so I do not question the usefulness of raising it. Just let it be raised ;)

instead of EVT_CLIENT_AUTH

Not really. The EVT_CLIENT_AUTH is fired by the Client class when authentication happens. Parsers don't raise this event.

in EVT_CLIENT_CONNECT the client is not authed, but in EVT_PUNKBUSTER_NEW_CONNECTION or EVT_CLIENT_AUTH the client is authed.

  • in EVT_CLIENT_AUTH: this is expected
  • in EVT_CLIENT_CONNECT: also expected for most parsers I believe
  • in EVT_PUNKBUSTER_NEW_CONNECTION: That might be the case but there is no warranty it would be. Plugins should not assume a client is authed when receiving this event.

Wouldn't it be better to use just 1 event?

I don't think so. Events are supposed to be used in different situations and hold different data that would be used in different ways.

danielepantaleone commented 9 years ago

Alright. I didn't dig in the code so I assumed that EVT_PUNKBUSTER_NEW_CONNECTION was a drop in replacement for EVT_CLIENT_AUTH in frostbite parsers when using punkbuster. I thought so because I saw in some plugins make this distinction and I did the same. i guess I'll correct some of my code and send u a pull request later in the evening