koraktor / steam-condenser

A multi-language library for querying the Steam Community, Source, GoldSrc servers and Steam master servers
https://koraktor.de/steam-condenser
Other
358 stars 67 forks source link

Querying L4D2 server, trouble fetching steamids #94

Closed ccondrup closed 13 years ago

ccondrup commented 13 years ago

Hello again Koraktor, thanks a lot for maintaining and improving this! Appreciated!

L4D2 issue

I've written a php script which uses Condenser to query our community servers. We have 9x cstrike goldsrc servers, 1x cs:source, 1x l4d2 (and fingers crossed for condenser-support for our battlefield/call of duty-servers as well..). The script runs fine on all servers except on the L4D2 where it doesn't seem to register the rcon. The isExtended() method returns false, and hence players steamid's are not returned either. I want the steamid's, what should I check/debug? The rcon is set and works, verified using HLSW.

I had this issue with my older cloned rev, so I cloned master yesterday, but the issue remains. I tried to look for documentation regarding L4D2, couldn't find anything specific. Is it correct to use SourceServer? Any other special code that differs from querying a CS:Source server?

The only notice out of the ordinary is this: Notice: Expected S2A_PLAYER_Packet, got S2C_CHALLENGE_Packet. in steam-condenser/lib/steam/servers/GameServer.php on line 175 ..but I get that exact same message from all our servers, and the others still work and return steamids.

Here is what status in the server console returns (ids+ips altered, otherwise exact copy) status hostname: Hostname version : 2.0.5.6 4448 secure (unknown) udp/ip : 65.1.1.1:27025 [ public same ] os : Linux Dedicated map : c4m1_milltown_a players : 8 humans, 0 bots (8 max) (not hibernating) (reserved 1860000216050e9)

# userid name uniqueid connected ping loss state rate adr
#250 1 "MorgueFish" STEAM_1:0:117097 11:02 92 0 active 25000 89.15.76.143:27005
#251 2 "miKaireiDes" STEAM_1:0:774621 11:02 111 0 active 20000 93.16.42.118:27005
#252 3 "Pink Supervisor" STEAM_1:1:622127 11:02 128 0 active 20000 62.16.19.23:27005
#253 4 "Mr.scout" STEAM_1:0:8141386 11:02 129 1 active 5000 88.11.50.59:27005
#254 5 "LeedStraiF" STEAM_1:1:2789077 11:02 142 0 active 10000 91.28.97.146:27005
#255 6 "Xinortin" STEAM_1:0:2809926 11:02 155 0 active 10000 91.20.136.225:55054
#256 7 "Bhoog" STEAM_1:1:3275401 11:02 119 0 active 25000 87.58.25.127:27005
#257 8 "Starok" STEAM_1:0:5922522 11:02 189 0 active 13000 78.36.16.55:27005
#end

And a little FYI note on Goldsrc

Btw, also getting this on all our CS1.6 servers: Notice: Expected S2C_CHALLENGE_Packet, but timed out. The server is probably offline. in steam-condenser/lib/steam/servers/GameServer.php on line 182

Here's the full stack of notices for one cs1.6 query (which still works fine and reports what I expect) Notice: Sending packet of type "A2A_PING_Packet"... in lib/steam/sockets/SteamSocket.php on line 104 Notice: Received packet of type "A2A_ACK_Packet" in lib/steam/sockets/GoldSrcSocket.php on line 84 Notice: Sending packet of type "A2S_INFO_Packet"... in lib/steam/sockets/SteamSocket.php on line 104 Notice: Received packet of type "S2A_INFO2_Packet" in lib/steam/sockets/GoldSrcSocket.php on line 84 Notice: Sending packet of type "A2S_SERVERQUERY_GETCHALLENGE_Packet"... in lib/steam/sockets/SteamSocket.php on line 104 Notice: Expected S2C_CHALLENGE_Packet, but timed out. The server is probably offline. in lib/steam/servers/GameServer.php on line 182 Notice: Sending packet of type "A2S_PLAYER_Packet"... in lib/steam/sockets/SteamSocket.php on line 104 Notice: Received packet of type "S2C_CHALLENGE_Packet" in lib/steam/sockets/GoldSrcSocket.php on line 84 Notice: Expected S2A_PLAYER_Packet, got S2C_CHALLENGE_Packet. in lib/steam/servers/GameServer.php on line 175 Notice: Sending packet of type "A2S_PLAYER_Packet"... in lib/steam/sockets/SteamSocket.php on line 104 Notice: Received packet of type "S2A_PLAYER_Packet" in lib/steam/sockets/GoldSrcSocket.php on line 84 Notice: Sending packet of type "RCONGoldSrcRequest"... in lib/steam/sockets/SteamSocket.php on line 104 Notice: Received packet of type "RCONGoldSrcResponse" in lib/steam/sockets/GoldSrcSocket.php on line 84 Notice: Sending packet of type "RCONGoldSrcRequest"... in lib/steam/sockets/SteamSocket.php on line 104 Notice: Received packet of type "RCONGoldSrcResponse" in lib/steam/sockets/GoldSrcSocket.php on line 84

koraktor commented 13 years ago

Ok... first about those "expected... but timeout" messages. You can safely ignore them. The challenge feature it seems got removed from the servers long ago and never came back. Steam Condenser can handle this.

Regarding the main problem it may be L4D2 has another format for the status output. You can compare this to the output of another Source game server. I'll have a look at it soon.

ccondrup commented 13 years ago

Allright, thanks. Let me know if I can assist in any way. I will try to compare some status-dumps from cs:s and l4d2, see if I can spot any differences.

ccondrup commented 13 years ago

Another update (and follow-up to the PM I sent): Using latest php master (grabbed 5 hours ago) querying our two L4D2-servers now goes like this:

a) No players on the server = Condenser fetches everything as it should b) If anyone on the server = Condenser will receive a TimeoutException (I have experimented with different timeout settings, it is now at 5000ms)

As soon as the last player leaves, Condenser fetches correctly again.

Another status dump from L4D2: status hostname: Hostname version : 2.0.5.8 4448 secure (unknown) udp/ip : 65.1.1.1:27025 [ public same ] os : Linux Dedicated map : l4d_mic2_decentd players : 4 humans, 0 bots (4 max) (not hibernating) (reserved 186000025016e14)

# userid name uniqueid connected ping loss state rate adr
# 444 1 "Anders" STEAM_1:0:257588 35:42 95 0 active 25000 85.18.14.6:27005
# 445 2 ">Tv-TiME<" STEAM_1:1:13255 35:42 90 0 active 20000 212.1.1.35:62046
# 513 8 "lÑà¹Å¦à¸¢Ð³" STEAM_1:1:983926 05:50 99 0 active 25000 89.1.6.45:27005
# 514 9 "srbz" STEAM_1:1:62400 05:25 91 0 active 20000 80.2.1.179:27005
#end
koraktor commented 13 years ago

Ok, what action is failing? RCON, getting players, getting rules or getting server info?

ccondrup commented 13 years ago
rconAuth($rcon)
initialize()
getPing()
getServerInfo()
getRules()
getPlayers()    

Those all work as expected, but then getPlayers($rcon) Results in an exception, here's a trimmed version of the object: Timeout Exception ( [file] => SteamSocket.php:79, [trace] = array (

  1. RCONSocket.php:55 func:receivePacket() args:array(0=>1440),
  2. SourceServer.php:75 func:getReply() args:array(),
  3. GameServer.php:226 func:rconExec() args:array(0=>status),
  4. GameServer.php:87 func:updatePlayerInfo() args:array(0=>myrconpw), ) )

Edit: I then tried rconExec("meta list"), timeout again, trace: [0] => Array ( [file] => lib/steam/sockets/RCONSocket.php [line] => 55 [function] => receivePacket [class] => SteamSocket [type] => -> [args] => Array ( [0] => 1440 ) ) [1] => Array ( [file] => lib/steam/servers/SourceServer.php [line] => 75 [function] => getReply [class] => RCONSocket [type] => -> [args] => Array ( ) ) [2] => Array ( [file] => servers_condenser.php [line] => 115 [function] => rconExec [class] => SourceServer [type] => -> [args] => Array ( [0] => meta list ) )

koraktor commented 13 years ago

This should be fixed with d07ccae2890a4f66bca861efab8c51799b433f2f. Please test again.

ccondrup commented 13 years ago

Hello, sorry for late reply, Github sometimes emails me about notices, and sometimes not?

Cloned master 10 minutes ago, getting the same Timeout exception still. Both when running getPlayers($rcon) and when running rconExec("meta list"). This works fine on CS:Source, only having issues with the L4D2 servers. There were 2 players ingame when testing now (which means at least 2 bots), status dump: status hostname: L4D 2 version : 2.0.6.1 4490 secure (unknown) udp/ip : 85.196.87.88:27026 [ public same ] os : Linux Dedicated map : evac2 players : 2 humans, 0 bots (4 max) (not hibernating) (reserved 1860000294c078e)

# userid name uniqueid connected ping loss state rate adr
# 678 1 "Alucard X" STEAM_1:0:27906 41:15 160 0 active 10000 87.29.2.11:27005
# 681 2 "<-AnniBal->" STEAM_1:0:90222 41:15 156 0 active 30000 92.5.4.108:27005
#723 "Ellis" BOT active
#724 "Coach" BOT active
#763 "Spitter" BOT active
#764 "Jockey" BOT active
#end

Stack trace (Timeout set to 5000ms, and script takes that long to complete) Could not connect to server. Messages: $e->getMessage() contains «», print_r($e) contains:

TimeoutException Object
(
    [message:protected] => 
    [string:private] => 
    [code:protected] => 0
    [file:protected] => lib/steam/sockets/SteamSocket.php
    [line:protected] => 92
    [trace:private] => Array
        (
            [0] => Array
                (
                    [file] => lib/steam/sockets/RCONSocket.php
                    [line] => 66
                    [function] => receivePacket
                    [class] => SteamSocket
                    [type] => ->
                    [args] => Array
                        (
                            [0] => 1440
                        )

                )

            [1] => Array
                (
                    [file] => lib/steam/servers/SourceServer.php
                    [line] => 84
                    [function] => getReply
                    [class] => RCONSocket
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [2] => Array
                (
                    [file] => lib/steam/servers/GameServer.php
                    [line] => 226
                    [function] => rconExec
                    [class] => SourceServer
                    [type] => ->
                    [args] => Array
                        (
                            [0] => status
                        )

                )

            [3] => Array
                (
                    [file] => lib/steam/servers/GameServer.php
                    [line] => 87
                    [function] => updatePlayerInfo
                    [class] => GameServer
                    [type] => ->
                    [args] => Array
                        (
                            [0] => myrconpw
                        )

                )

            [4] => Array
                (
                    [file] => include/servers_condenser.php
                    [line] => 126
                    [function] => getPlayers
                    [class] => GameServer
                    [type] => ->
                    [args] => Array
                        (
                            [0] => myrconpw
                        )

                )

        )

)
koraktor commented 13 years ago

So it seems like L4D(2) uses a slightly different protocol for RCON.

Line number 84 in lib/steam/servers/SourceServer.php suggests, that L4D(2) doesn't support the new termination feature that will "ask" the server to end the RCON response.

I will try to setup a server today and test specifically for L4D(2).

koraktor commented 13 years ago

Commit c9d2c0bd43b1ea3c381f74b5446a33c7c52a1f7b has a fix -- hopefully the last one.

ccondrup commented 13 years ago

Thanks, but still getting timeout on getPlayers(rcon). Let me again point out that it works fine when there are no players on the server. It returns all info and completes without a problem. Once I join the server and start a campaign so there is 1 player(me) + 3 bots playing, I immediately get errors on the rcon-commands.

Btw: You have noticed that the status output lines are different for players and bots, right? Bots have no space between # and their id, like players do.

Paste of status while testing now http://pastie.org/1653226 (no idea why it says 0 bots when there are clearly 3) Latest stack trace: http://pastie.org/1653285

koraktor commented 13 years ago

Ok, seems like L4D2 is really tough. I'll try to test again while playing on the server. The RCON part should be really working now, so I wonder if there's any additional tripwire.

Thanks for testing, though.

koraktor commented 13 years ago

Sorry. First for taking so long to test this myself. Second because I wasn't able to reproduce this.

I tested this on a SRCDS running on an Ubuntu VM hosted on the machine where I also joined the game. RCON requests came from a second physical machine in the same network. No problems. Maybe the timeouts are caused by some other factor.

The status format is different for L4D2, so there will be a fix for this soon.

koraktor commented 13 years ago

Commit f66f5796a828d7837d34ee827be00dbab589a237 should fix the parsing problem.

ccondrup commented 13 years ago

Thanks for the update. I just downloaded master and now receive error: Parse error: syntax error, unexpected T_FUNCTION in lib/steam/servers/GameServer.php on line 227 Doesn't seem to like the anon function there. PHP Version 5.2.13-pl0-gentoo.

As for the timeout.. would you mind testing against our servers? I'll PM details.

koraktor commented 13 years ago

The incompatibility for PHP < 5.3 is now fixed in d40561ef787de25e07752459c967bae16a58df72.

I'll try to fix the timeouts ASAP. Shouldn't take another age thanks to your help.

koraktor commented 13 years ago

Although I don't want to make any further empty promises, the latest series of patches – especially 349e35d34dad0a6d1ef8fa5306301c35afde372f – should finally fix this and other RCON related problems. Feel free to test.

ccondrup commented 13 years ago

Tada! It works! Great job, thanks for this awesome effort!

koraktor commented 13 years ago

Good to hear. :)