Skip to content

Commit

Permalink
add socket active validation
Browse files Browse the repository at this point in the history
  • Loading branch information
yggverse committed Apr 27, 2024
1 parent 7923fea commit 55b4c87
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,17 @@ public function start(
STREAM_SERVER_BIND | STREAM_SERVER_LISTEN
);

if ($this->_live)
{
$this->_live = is_resource(
$socket
);
}

do
{
if (!$this->_live)
{
fclose(
$socket
);

break;
}

Expand Down Expand Up @@ -160,6 +163,13 @@ public function start(
);

} while ($this->_live);

if (is_resource($socket))
{
fclose(
$socket
);
}
}

public function stop(): void
Expand Down

0 comments on commit 55b4c87

Please sign in to comment.