Code cleanup, no functional changes
This commit is contained in:
@@ -128,7 +128,7 @@ final class SocketClient {
|
||||
do {
|
||||
$this->buffer_flush(5);
|
||||
|
||||
if ($this->tty_status == self::TTY_SUCCESS) {
|
||||
if ($this->tty_status === self::TTY_SUCCESS) {
|
||||
$n = min($this->tx_free,$num_bytes);
|
||||
$this->tx_buf = substr($data,$ptr,$n);
|
||||
$this->tx_free -= $n;
|
||||
@@ -189,7 +189,7 @@ final class SocketClient {
|
||||
if ($this->DEBUG)
|
||||
Log::debug(sprintf('%s: - Sent [%d] (%s)',self::LOGKEY,$rc,Str::limit($this->tx_buf,15)));
|
||||
|
||||
if ($rc == $restsize) {
|
||||
if ($rc === $restsize) {
|
||||
$this->tx_buf = '';
|
||||
$tx_ptr = 0;
|
||||
$this->tx_free += $rc;
|
||||
@@ -271,14 +271,14 @@ final class SocketClient {
|
||||
|
||||
foreach ($resolved as $address) {
|
||||
try {
|
||||
$try = Arr::get($address,Arr::get($address,'type') == 'AAAA' ? 'ipv6' : 'ip');
|
||||
$try = Arr::get($address,Arr::get($address,'type') === 'AAAA' ? 'ipv6' : 'ip');
|
||||
if (! $try)
|
||||
continue;
|
||||
|
||||
Log::alert(sprintf('%s: - Trying [%s:%d]',self::LOGKEY,$try,$port));
|
||||
|
||||
/* Create a TCP/IP socket. */
|
||||
$socket = socket_create(Arr::get($address,'type') == 'AAAA' ? AF_INET6 : AF_INET,SOCK_STREAM,SOL_TCP);
|
||||
$socket = socket_create(Arr::get($address,'type') === 'AAAA' ? AF_INET6 : AF_INET,SOCK_STREAM,SOL_TCP);
|
||||
if ($socket === FALSE)
|
||||
throw new SocketException(SocketException::CANT_CREATE_SOCKET,socket_strerror(socket_last_error($socket)));
|
||||
|
||||
@@ -287,7 +287,7 @@ final class SocketClient {
|
||||
|
||||
} catch (\ErrorException $e) {
|
||||
// If 'Cannot assign requested address'
|
||||
if (socket_last_error($socket) == 99)
|
||||
if (socket_last_error($socket) === 99)
|
||||
continue;
|
||||
|
||||
throw new SocketException(SocketException::CANT_CONNECT,socket_strerror(socket_last_error($socket)));
|
||||
@@ -382,7 +382,7 @@ final class SocketClient {
|
||||
|
||||
// If our buffer is null, see if we have any out of band data.
|
||||
// @todo We throw an errorexception when the socket is closed by the remote I think.
|
||||
if (($rc == 0) && is_nulL($buf) && ($this->hasData(0) > 0)) {
|
||||
if (($rc === 0) && is_nulL($buf) && ($this->hasData(0) > 0)) {
|
||||
try {
|
||||
socket_recv($this->connection,$buf, $len,MSG_OOB);
|
||||
|
||||
@@ -408,7 +408,7 @@ final class SocketClient {
|
||||
Log::debug(sprintf('%s:+ Start [%d] - rx_left[%d], rx_ptr[%d]',self::LOGKEY,$timeout,$this->rx_left,$this->rx_ptr));
|
||||
|
||||
// If our buffer is empty, we'll try and read from the remote
|
||||
if ($this->rx_left == 0) {
|
||||
if ($this->rx_left === 0) {
|
||||
if ($this->hasData($timeout) > 0) {
|
||||
try {
|
||||
if (! strlen($this->rx_buf = $this->read(0,self::RX_BUF_SIZE))) {
|
||||
@@ -419,7 +419,7 @@ final class SocketClient {
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return ($e->getCode() == 11) ? self::TTY_TIMEOUT : self::ERROR;
|
||||
return ($e->getCode() === 11) ? self::TTY_TIMEOUT : self::ERROR;
|
||||
}
|
||||
|
||||
if ($this->DEBUG)
|
||||
|
Reference in New Issue
Block a user