mirror of
https://github.com/xPaw/PHP-Source-Query.git
synced 2026-05-18 13:53:35 +02:00
Minor cosmetic changes, throw an error when rcon read fails (#42)
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
use xPaw\SourceQuery\Exception\InvalidPacketException;
|
||||
use xPaw\SourceQuery\Exception\SocketException;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Class written by xPaw
|
||||
*
|
||||
* Website: http://xpaw.me
|
||||
* GitHub: https://github.com/xPaw/PHP-Source-Query-Class
|
||||
*/
|
||||
|
||||
use xPaw\SourceQuery\Exception\InvalidPacketException;
|
||||
use xPaw\SourceQuery\Exception\SocketException;
|
||||
|
||||
class SourceQuerySocket
|
||||
{
|
||||
public $Socket;
|
||||
@@ -51,7 +51,7 @@ use xPaw\SourceQuery\Exception\SocketException;
|
||||
|
||||
if( $ErrNo || $this->Socket === false )
|
||||
{
|
||||
throw new SocketException( 'Could not create socket: ' . $ErrStr, SocketException::COULD_NOT_CREATE_SOCKET);
|
||||
throw new SocketException( 'Could not create socket: ' . $ErrStr, SocketException::COULD_NOT_CREATE_SOCKET );
|
||||
}
|
||||
|
||||
Stream_Set_Timeout( $this->Socket, $Timeout );
|
||||
@@ -146,7 +146,7 @@ use xPaw\SourceQuery\Exception\SocketException;
|
||||
|
||||
if( CRC32( $Buffer ) !== $PacketChecksum )
|
||||
{
|
||||
throw new InvalidPacketException( 'CRC32 checksum mismatch of uncompressed packet data.', InvalidPacketException::CHECKSUM_MISMATCH);
|
||||
throw new InvalidPacketException( 'CRC32 checksum mismatch of uncompressed packet data.', InvalidPacketException::CHECKSUM_MISMATCH );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ use xPaw\SourceQuery\Exception\SocketException;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidPacketException( 'Socket read: Raw packet header mismatch. (0x' . DecHex( $Header ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH);
|
||||
throw new InvalidPacketException( 'Socket read: Raw packet header mismatch. (0x' . DecHex( $Header ) . ')', InvalidPacketException::PACKET_HEADER_MISMATCH );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user