mirror of
https://github.com/YGGverse/hl-php.git
synced 2025-02-05 11:14:20 +00:00
fix packet reader
This commit is contained in:
parent
33a77a858b
commit
726463e94e
@ -88,13 +88,7 @@ class Master
|
|||||||
// Get host
|
// Get host
|
||||||
if (false === $host = fread($this->_socket, 16))
|
if (false === $host = fread($this->_socket, 16))
|
||||||
{
|
{
|
||||||
fclose(
|
break;
|
||||||
$this->_socket
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->_errors[] = _('Could not read server address');
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is end of packet
|
// Is end of packet
|
||||||
@ -103,34 +97,28 @@ class Master
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip invalid host
|
// Skip invalid host value
|
||||||
if (false === $host = inet_ntop($host))
|
if (false === $host = inet_ntop($host))
|
||||||
{
|
{
|
||||||
|
// Shift port bytes
|
||||||
|
fread($this->_socket, 2);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode first byte for port
|
// Decode first byte for port
|
||||||
if (false === $byte1 = fread($this->_socket, 1))
|
if (false === $byte1 = fread($this->_socket, 1))
|
||||||
{
|
{
|
||||||
fclose(
|
// Shift port byte
|
||||||
$this->_socket
|
fread($this->_socket, 1);
|
||||||
);
|
|
||||||
|
|
||||||
$this->_errors[] = _('Could not read first byte of port');
|
continue;
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode second byte for port
|
// Decode second byte for port
|
||||||
if (false === $byte2 = fread($this->_socket, 1))
|
if (false === $byte2 = fread($this->_socket, 1))
|
||||||
{
|
{
|
||||||
fclose(
|
continue;
|
||||||
$this->_socket
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->_errors[] = _('Could not read second byte of port');
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate port value
|
// Calculate port value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user