From ed5a98cb2305942b0b6047caf790a37c1f0711a3 Mon Sep 17 00:00:00 2001 From: xPaw Date: Mon, 20 Oct 2014 17:05:10 +0300 Subject: [PATCH] Initialize rcon only when setting rcon password --- SourceQuery/SourceQuery.class.php | 34 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/SourceQuery/SourceQuery.class.php b/SourceQuery/SourceQuery.class.php index 580fedd..47bf8b2 100644 --- a/SourceQuery/SourceQuery.class.php +++ b/SourceQuery/SourceQuery.class.php @@ -148,22 +148,6 @@ } $this->Connected = true; - - switch( $this->Socket->Engine ) - { - case SourceQuery :: GOLDSOURCE: - { - $this->Rcon = new SourceQueryGoldSourceRcon( $this->Buffer, $this->Socket ); - - break; - } - case SourceQuery :: SOURCE: - { - $this->Rcon = new SourceQuerySourceRcon( $this->Buffer, $this->Socket ); - - break; - } - } } /** @@ -197,6 +181,8 @@ if( $this->Rcon ) { $this->Rcon->Close( ); + + $this->Rcon = null; } } @@ -537,6 +523,22 @@ return false; } + switch( $this->Socket->Engine ) + { + case SourceQuery :: GOLDSOURCE: + { + $this->Rcon = new SourceQueryGoldSourceRcon( $this->Buffer, $this->Socket ); + + break; + } + case SourceQuery :: SOURCE: + { + $this->Rcon = new SourceQuerySourceRcon( $this->Buffer, $this->Socket ); + + break; + } + } + $this->Rcon->Open( ); return $this->Rcon->Authorize( $Password );