Fix typo: sleep 1s when error is EMFILE or ENFILE
@@ -22,7 +22,8 @@ use Swow\Http\Server as HttpServer;
use Swow\Http\Status as HttpStatus;
use Swow\Socket\Exception as SocketException;
use Swow\WebSocket\Opcode as WebSocketOpcode;
-use const Swow\ENOMEM;
+use const Swow\EMFILE;
+use const Swow\ENFILE;
$server = new HttpServer();
$server->bind('0.0.0.0', 9764)->listen();
@@ -98,7 +99,7 @@ while (true) {
} catch (SocketException $exception) {
break;
} catch (CoroutineException $exception) {
- if ($exception->getCode() === ENOMEM) {
+ if (in_array($exception->getCode(), [EMFILE, ENFILE], true)) {
sleep(1);
} else {
break;
