From 77e5af8745e6ce6ccce68343f8fbd10e2bae5f71 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 18 Oct 2015 22:01:28 +0300 Subject: [PATCH] Remove socket open check which can never be false --- SourceQuery/Socket.php | 2 -- SourceQuery/SourceQuery.php | 8 +------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/SourceQuery/Socket.php b/SourceQuery/Socket.php index cb67082..b27027b 100644 --- a/SourceQuery/Socket.php +++ b/SourceQuery/Socket.php @@ -70,8 +70,6 @@ Stream_Set_Timeout( $this->Socket, $Timeout ); Stream_Set_Blocking( $this->Socket, true ); - - return true; } public function Write( $Header, $String = '' ) diff --git a/SourceQuery/SourceQuery.php b/SourceQuery/SourceQuery.php index 82fc0fd..9198e88 100644 --- a/SourceQuery/SourceQuery.php +++ b/SourceQuery/SourceQuery.php @@ -15,7 +15,6 @@ use xPaw\SourceQuery\Exception\InvalidArgumentException; use xPaw\SourceQuery\Exception\InvalidPacketException; use xPaw\SourceQuery\Exception\SocketException; - use xPaw\SourceQuery\Exception\TimeoutException; /** * Class SourceQuery @@ -25,7 +24,6 @@ * @uses xPaw\SourceQuery\Exception\InvalidArgumentException * @uses xPaw\SourceQuery\Exception\InvalidPacketException * @uses xPaw\SourceQuery\Exception\SocketException - * @uses xPaw\SourceQuery\Exception\TimeoutException */ class SourceQuery { @@ -138,7 +136,6 @@ * @param int $Engine Engine the server runs on (goldsource, source) * * @throws InvalidArgumentException - * @throws TimeoutException * @throws SocketException */ public function Connect( $Ip, $Port, $Timeout = 3, $Engine = self::SOURCE ) @@ -150,10 +147,7 @@ throw new InvalidArgumentException( 'Timeout must be an integer.', InvalidArgumentException::TIMEOUT_NOT_INTEGER ); } - if( !$this->Socket->Open( $Ip, (int)$Port, $Timeout, (int)$Engine ) ) - { - throw new TimeoutException( 'Could not connect to server.', TimeoutException::TIMEOUT_CONNECT ); - } + $this->Socket->Open( $Ip, (int)$Port, $Timeout, (int)$Engine ); $this->Connected = true; }