add socket active validation

This commit is contained in:
yggverse 2024-04-27 16:13:39 +03:00
parent f8a0f2e350
commit 003393b129

View File

@ -173,14 +173,17 @@ class Server
STREAM_SERVER_BIND | STREAM_SERVER_LISTEN STREAM_SERVER_BIND | STREAM_SERVER_LISTEN
); );
if ($this->_live)
{
$this->_live = is_resource(
$socket
);
}
do do
{ {
if (!$this->_live) if (!$this->_live)
{ {
fclose(
$socket
);
break; break;
} }
@ -289,6 +292,13 @@ class Server
); );
} while ($this->_live); } while ($this->_live);
if (is_resource($socket))
{
fclose(
$socket
);
}
} }
public function stop(): void public function stop(): void