mirror of
https://github.com/YGGverse/hl-php.git
synced 2026-03-31 17:15:39 +00:00
fix packet reader
This commit is contained in:
parent
33a77a858b
commit
726463e94e
1 changed files with 9 additions and 21 deletions
|
|
@ -88,13 +88,7 @@ class Master
|
|||
// Get host
|
||||
if (false === $host = fread($this->_socket, 16))
|
||||
{
|
||||
fclose(
|
||||
$this->_socket
|
||||
);
|
||||
|
||||
$this->_errors[] = _('Could not read server address');
|
||||
|
||||
return null;
|
||||
break;
|
||||
}
|
||||
|
||||
// Is end of packet
|
||||
|
|
@ -103,34 +97,28 @@ class Master
|
|||
break;
|
||||
}
|
||||
|
||||
// Skip invalid host
|
||||
// Skip invalid host value
|
||||
if (false === $host = inet_ntop($host))
|
||||
{
|
||||
// Shift port bytes
|
||||
fread($this->_socket, 2);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Decode first byte for port
|
||||
if (false === $byte1 = fread($this->_socket, 1))
|
||||
{
|
||||
fclose(
|
||||
$this->_socket
|
||||
);
|
||||
// Shift port byte
|
||||
fread($this->_socket, 1);
|
||||
|
||||
$this->_errors[] = _('Could not read first byte of port');
|
||||
|
||||
return null;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Decode second byte for port
|
||||
if (false === $byte2 = fread($this->_socket, 1))
|
||||
{
|
||||
fclose(
|
||||
$this->_socket
|
||||
);
|
||||
|
||||
$this->_errors[] = _('Could not read second byte of port');
|
||||
|
||||
return null;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Calculate port value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue