Browse Source

add socket active validation

main 1.1.1
yggverse 7 months ago
parent
commit
55b4c879e4
  1. 18
      src/Server.php

18
src/Server.php

@ -108,14 +108,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;
} }
@ -160,6 +163,13 @@ class Server
); );
} while ($this->_live); } while ($this->_live);
if (is_resource($socket))
{
fclose(
$socket
);
}
} }
public function stop(): void public function stop(): void

Loading…
Cancel
Save