mirror of
https://github.com/YGGverse/hl-php.git
synced 2026-03-31 17:15:39 +00:00
add socket connection closers
This commit is contained in:
parent
49c5c76908
commit
6479e40496
1 changed files with 21 additions and 0 deletions
|
|
@ -65,6 +65,10 @@ class Master
|
||||||
// Skip header
|
// Skip header
|
||||||
if (!fread($this->_socket, 6))
|
if (!fread($this->_socket, 6))
|
||||||
{
|
{
|
||||||
|
fclose(
|
||||||
|
$this->_socket
|
||||||
|
);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,6 +80,10 @@ class Master
|
||||||
// Get host
|
// Get host
|
||||||
if (false === $host = fread($this->_socket, 16))
|
if (false === $host = fread($this->_socket, 16))
|
||||||
{
|
{
|
||||||
|
fclose(
|
||||||
|
$this->_socket
|
||||||
|
);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,12 +102,20 @@ class Master
|
||||||
// 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(
|
||||||
|
$this->_socket
|
||||||
|
);
|
||||||
|
|
||||||
return null;
|
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(
|
||||||
|
$this->_socket
|
||||||
|
);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,6 +139,11 @@ class Master
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close connection
|
||||||
|
fclose(
|
||||||
|
$this->_socket
|
||||||
|
);
|
||||||
|
|
||||||
return $servers;
|
return $servers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue