Skip to content

Commit 3c5be15

Browse files
#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).
1 parent f9b884d commit 3c5be15

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Components/ServerConfig.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class ServerConfig
1212
private int $clientsPerFork = WebSocketServerContract::CLIENTS_PER_FORK;
1313

1414
/**
15-
* @var int
15+
* @var int|null
1616
*/
17-
private int $streamSelectTimeout = WebSocketServerContract::STREAM_SELECT_TIMEOUT;
17+
private ?int $streamSelectTimeout = WebSocketServerContract::STREAM_SELECT_TIMEOUT;
1818

1919
/**
2020
* @var string
@@ -78,15 +78,15 @@ class ServerConfig
7878
private int $cryptoType;
7979

8080
/**
81-
* @return mixed
81+
* @return int
8282
*/
8383
public function getClientsPerFork(): int
8484
{
8585
return $this->clientsPerFork;
8686
}
8787

8888
/**
89-
* @param mixed $clientsPerFork
89+
* @param int $clientsPerFork
9090
* @return ServerConfig
9191
*/
9292
public function setClientsPerFork(int $clientsPerFork): ServerConfig
@@ -96,18 +96,18 @@ public function setClientsPerFork(int $clientsPerFork): ServerConfig
9696
}
9797

9898
/**
99-
* @return mixed
99+
* @return null|int
100100
*/
101-
public function getStreamSelectTimeout(): int
101+
public function getStreamSelectTimeout(): ?int
102102
{
103103
return $this->streamSelectTimeout;
104104
}
105105

106106
/**
107-
* @param mixed $streamSelectTimeout
107+
* @param null|int $streamSelectTimeout
108108
* @return ServerConfig
109109
*/
110-
public function setStreamSelectTimeout(int $streamSelectTimeout): ServerConfig
110+
public function setStreamSelectTimeout(?int $streamSelectTimeout): ServerConfig
111111
{
112112
$this->streamSelectTimeout = $streamSelectTimeout;
113113
return $this;

0 commit comments

Comments
 (0)