Skip to content

Commit ed5a98c

Browse files
committed
Initialize rcon only when setting rcon password
1 parent 77d8a3a commit ed5a98c

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

SourceQuery/SourceQuery.class.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,6 @@ public function Connect( $Ip, $Port, $Timeout = 3, $Engine = self :: SOURCE )
148148
}
149149

150150
$this->Connected = true;
151-
152-
switch( $this->Socket->Engine )
153-
{
154-
case SourceQuery :: GOLDSOURCE:
155-
{
156-
$this->Rcon = new SourceQueryGoldSourceRcon( $this->Buffer, $this->Socket );
157-
158-
break;
159-
}
160-
case SourceQuery :: SOURCE:
161-
{
162-
$this->Rcon = new SourceQuerySourceRcon( $this->Buffer, $this->Socket );
163-
164-
break;
165-
}
166-
}
167151
}
168152

169153
/**
@@ -197,6 +181,8 @@ public function Disconnect( )
197181
if( $this->Rcon )
198182
{
199183
$this->Rcon->Close( );
184+
185+
$this->Rcon = null;
200186
}
201187
}
202188

@@ -537,6 +523,22 @@ public function SetRconPassword( $Password )
537523
return false;
538524
}
539525

526+
switch( $this->Socket->Engine )
527+
{
528+
case SourceQuery :: GOLDSOURCE:
529+
{
530+
$this->Rcon = new SourceQueryGoldSourceRcon( $this->Buffer, $this->Socket );
531+
532+
break;
533+
}
534+
case SourceQuery :: SOURCE:
535+
{
536+
$this->Rcon = new SourceQuerySourceRcon( $this->Buffer, $this->Socket );
537+
538+
break;
539+
}
540+
}
541+
540542
$this->Rcon->Open( );
541543

542544
return $this->Rcon->Authorize( $Password );

0 commit comments

Comments
 (0)