diff --git a/SourceQuery/GoldSourceRcon.php b/SourceQuery/GoldSourceRcon.php index 6e93dc1..a9c5ce3 100644 --- a/SourceQuery/GoldSourceRcon.php +++ b/SourceQuery/GoldSourceRcon.php @@ -71,7 +71,7 @@ if( $Buffer->GetByte( ) !== SourceQuery::S2A_RCON ) { - return false; + throw new InvalidPacketException( 'Invalid rcon response.', InvalidPacketException::PACKET_HEADER_MISMATCH ); } $Buffer = $Buffer->Get( ); @@ -114,7 +114,7 @@ { if( !$this->RconChallenge ) { - return false; + throw new AuthenticationException( 'Tried to execute a RCON command before successful authorization.', AuthenticationException::BAD_PASSWORD ); } $this->Write( 0, 'rcon ' . $this->RconChallenge . ' "' . $this->RconPassword . '" ' . $Command . "\0" ); @@ -132,11 +132,9 @@ if( $Buffer->Get( 14 ) !== 'challenge rcon' ) { - return false; + throw new AuthenticationException( 'Failed to get RCON challenge.', AuthenticationException::BAD_PASSWORD ); } $this->RconChallenge = Trim( $Buffer->Get( ) ); - - return true; } } diff --git a/SourceQuery/SourceQuery.php b/SourceQuery/SourceQuery.php index 12e13b9..92c857b 100644 --- a/SourceQuery/SourceQuery.php +++ b/SourceQuery/SourceQuery.php @@ -503,8 +503,6 @@ * @throws AuthenticationException * @throws InvalidPacketException * @throws SocketException - * - * @return bool True if authentication succeeded, false on failure */ public function SetRconPassword( $Password ) { @@ -530,8 +528,7 @@ } $this->Rcon->Open( ); - - return $this->Rcon->Authorize( $Password ); + $this->Rcon->Authorize( $Password ); } /** diff --git a/SourceQuery/SourceRcon.php b/SourceQuery/SourceRcon.php index 2e722f2..c132ad9 100644 --- a/SourceQuery/SourceRcon.php +++ b/SourceQuery/SourceRcon.php @@ -137,7 +137,7 @@ } else if( $Type !== SourceQuery::SERVERDATA_RESPONSE_VALUE ) { - return false; + throw new InvalidPacketException( 'Invalid rcon response.', InvalidPacketException::PACKET_HEADER_MISMATCH ); } $Data = $Buffer->Get( ); @@ -197,7 +197,5 @@ { throw new AuthenticationException( 'RCON authorization failed.', AuthenticationException::BAD_PASSWORD ); } - - return true; } }