Skip to content

Commit cd36247

Browse files
committed
Use Valve's packet names (proto_oob.h)
1 parent e96807b commit cd36247

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

SourceQuery/SourceQuery.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SourceQuery
3838
/**
3939
* Packets sent
4040
*/
41-
const A2S_PING = 0x69;
41+
const A2A_PING = 0x69;
4242
const A2S_INFO = 0x54;
4343
const A2S_PLAYER = 0x55;
4444
const A2S_RULES = 0x56;
@@ -47,10 +47,10 @@ class SourceQuery
4747
/**
4848
* Packets received
4949
*/
50-
const S2A_PING = 0x6A;
51-
const S2A_CHALLENGE = 0x41;
52-
const S2A_INFO = 0x49;
53-
const S2A_INFO_OLD = 0x6D; // Old GoldSource, HLTV uses it
50+
const A2A_ACK = 0x6A;
51+
const S2C_CHALLENGE = 0x41;
52+
const S2A_INFO_SRC = 0x49;
53+
const S2A_INFO_OLD = 0x6D; // Old GoldSource, HLTV uses it (actually called S2A_INFO_DETAILED)
5454
const S2A_PLAYER = 0x44;
5555
const S2A_RULES = 0x45;
5656
const S2A_RCON = 0x6C;
@@ -180,10 +180,10 @@ public function Ping( ) : bool
180180
throw new SocketException( 'Not connected.', SocketException::NOT_CONNECTED );
181181
}
182182

183-
$this->Socket->Write( self::A2S_PING );
183+
$this->Socket->Write( self::A2A_PING );
184184
$Buffer = $this->Socket->Read( );
185185

186-
return $Buffer->GetByte( ) === self::S2A_PING;
186+
return $Buffer->GetByte( ) === self::A2A_ACK;
187187
}
188188

189189
/**
@@ -214,7 +214,7 @@ public function GetInfo( ) : array
214214
$Type = $Buffer->GetByte( );
215215
$Server = [];
216216

217-
if( $Type === self::S2A_CHALLENGE )
217+
if( $Type === self::S2C_CHALLENGE )
218218
{
219219
$this->Challenge = $Buffer->Get( 4 );
220220

@@ -264,7 +264,7 @@ public function GetInfo( ) : array
264264
return $Server;
265265
}
266266

267-
if( $Type !== self::S2A_INFO )
267+
if( $Type !== self::S2A_INFO_SRC )
268268
{
269269
throw new InvalidPacketException( 'GetInfo: Packet header mismatch. (0x' . DecHex( $Type ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH );
270270
}
@@ -479,7 +479,7 @@ private function GetChallenge( int $Header, int $ExpectedResult ) : void
479479

480480
switch( $Type )
481481
{
482-
case self::S2A_CHALLENGE:
482+
case self::S2C_CHALLENGE:
483483
{
484484
$this->Challenge = $Buffer->Get( 4 );
485485

0 commit comments

Comments
 (0)