frostschutz / SourceLib

Python implementation of Valve Source Dedicated Server Query/RCON/Log protocols.
39 stars 20 forks source link

Hey. I fixed your ping thing that quit working. There was a change in protocol and they removed A2S_PING, so I changed the library to use the A2S_INFO instead. #7

Closed misutowolf closed 12 years ago

frostschutz commented 12 years ago

If ping has been removed it can't be helped, but somehow it seems a shame to query info from the server to return the ping only. Maybe the functions should be consolidated, i.e. remove ping() altogether and just add a 'ping' entry to the info dict?

Otherwise people who want both ping and info end up querying info twice from the servers.

For backward compatibility ping() could then just return info()['ping'] and print a deprecation warning.

I'm not running gameservers anymore so I'm not up to date with recent developments. What do you think?

misutowolf commented 12 years ago

That might be a good idea. I just read somewhere in a forum or something while working with your library that they've completely gotten rid of the ping query, and I was going to be working on an app with the work you've done, so I thought I'd let you know. All I did with was just use the INFO query to calculate a ping, but that's probably a better idea, actually...

I'd definitely suggest just adding a ping entry to info(), and warning of A2S_PING's complete deprecation. I'm not sure how widespread the deprecation is, but I'm 90% sure it's pretty much every game now.

And it's probably better that you get the ping using an existing INFO query anyway, so that servers don't get angry or flooded with double-INFOs (one for ping, one for real info).

I could probably fiddle with it myself if you don't really want to do it. I'm a novice Python developer at best, but I'm sure I could manage that, and just move the code over to the info function definition.

On an unrelated note, I'm mad at Python because there's no menu extension for their Curses implementation. I wanted to write a little console app. :(