Skip to content

Commit

Permalink
#63: Add an ability to set $streamSelectTimeout = null, to provide co…
Browse files Browse the repository at this point in the history
…nfiguration 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).
  • Loading branch information
arthurkushman authored Mar 29, 2022
1 parent f9b884d commit 3c5be15
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Components/ServerConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -78,15 +78,15 @@ class ServerConfig
private int $cryptoType;

/**
* @return mixed
* @return int
*/
public function getClientsPerFork(): int
{
return $this->clientsPerFork;
}

/**
* @param mixed $clientsPerFork
* @param int $clientsPerFork
* @return ServerConfig
*/
public function setClientsPerFork(int $clientsPerFork): ServerConfig
Expand All @@ -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;
Expand Down

0 comments on commit 3c5be15

Please sign in to comment.