From 3c5be15252a876c19b064824835c02da1516ec01 Mon Sep 17 00:00:00 2001 From: Arthur Kushman Date: Tue, 29 Mar 2022 19:56:41 +0300 Subject: [PATCH] #63: Add an ability to set $streamSelectTimeout = null, to provide configuration of stream_select with: (#64) If seconds is null stream_select() can block indefinitely, returning only when an event on one of the watched streams occurs (or if a signal interrupts the system call). --- src/Components/ServerConfig.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Components/ServerConfig.php b/src/Components/ServerConfig.php index 544b48a..0adb018 100644 --- a/src/Components/ServerConfig.php +++ b/src/Components/ServerConfig.php @@ -12,9 +12,9 @@ class ServerConfig private int $clientsPerFork = WebSocketServerContract::CLIENTS_PER_FORK; /** - * @var int + * @var int|null */ - private int $streamSelectTimeout = WebSocketServerContract::STREAM_SELECT_TIMEOUT; + private ?int $streamSelectTimeout = WebSocketServerContract::STREAM_SELECT_TIMEOUT; /** * @var string @@ -78,7 +78,7 @@ class ServerConfig private int $cryptoType; /** - * @return mixed + * @return int */ public function getClientsPerFork(): int { @@ -86,7 +86,7 @@ public function getClientsPerFork(): int } /** - * @param mixed $clientsPerFork + * @param int $clientsPerFork * @return ServerConfig */ public function setClientsPerFork(int $clientsPerFork): ServerConfig @@ -96,18 +96,18 @@ public function setClientsPerFork(int $clientsPerFork): ServerConfig } /** - * @return mixed + * @return null|int */ - public function getStreamSelectTimeout(): int + public function getStreamSelectTimeout(): ?int { return $this->streamSelectTimeout; } /** - * @param mixed $streamSelectTimeout + * @param null|int $streamSelectTimeout * @return ServerConfig */ - public function setStreamSelectTimeout(int $streamSelectTimeout): ServerConfig + public function setStreamSelectTimeout(?int $streamSelectTimeout): ServerConfig { $this->streamSelectTimeout = $streamSelectTimeout; return $this;