1
0
mirror of https://github.com/xPaw/PHP-Source-Query.git synced 2026-05-18 14:33:34 +02:00

Assign socket only if it was created

Fixes #149
This commit is contained in:
Pavel Djundik
2021-04-16 10:07:10 +03:00
parent cd3624704e
commit 904e547fe4
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -42,13 +42,14 @@
$this->Port = $Port;
$this->Address = $Address;
$this->Socket = @FSockOpen( 'udp://' . $Address, $Port, $ErrNo, $ErrStr, $Timeout );
$Socket = @FSockOpen( 'udp://' . $Address, $Port, $ErrNo, $ErrStr, $Timeout );
if( $ErrNo || $this->Socket === false )
if( $ErrNo || $Socket === false )
{
throw new SocketException( 'Could not create socket: ' . $ErrStr, SocketException::COULD_NOT_CREATE_SOCKET );
}
$this->Socket = $Socket;
Stream_Set_Timeout( $this->Socket, $Timeout );
Stream_Set_Blocking( $this->Socket, true );
}