Small fix

This commit is contained in:
Daniil Gentili 2017-12-16 19:01:40 +00:00
parent a5231d43bd
commit 8a3cc16d53

View File

@ -24,6 +24,11 @@ if (!extension_loaded('pthreads')) {
$this->sock = socket_create($domain, $type, $protocol); $this->sock = socket_create($domain, $type, $protocol);
} }
public function __destruct()
{
socket_close($this->sock);
}
public function setOption(int $level, int $name, $value) public function setOption(int $level, int $name, $value)
{ {
if (in_array($name, [\SO_RCVTIMEO, \SO_SNDTIMEO])) { if (in_array($name, [\SO_RCVTIMEO, \SO_SNDTIMEO])) {
@ -129,6 +134,9 @@ if (!extension_loaded('pthreads')) {
{ {
$this->protocol = getprotobynumber($protocol); $this->protocol = getprotobynumber($protocol);
} }
public function __destruct() {
if ($this->sock !== NULL) fclose($this->sock);
}
public function setOption(int $level, int $name, $value) public function setOption(int $level, int $name, $value)
{ {