diff --git a/src/ExtEventLoop.php b/src/ExtEventLoop.php index 6df3fa71..40b860ae 100644 --- a/src/ExtEventLoop.php +++ b/src/ExtEventLoop.php @@ -4,6 +4,7 @@ use Event; use EventBase; +use EventConfig as EventBaseConfig; use React\EventLoop\Tick\FutureTickQueue; use React\EventLoop\Tick\NextTickQueue; use React\EventLoop\Timer\Timer; @@ -27,9 +28,9 @@ class ExtEventLoop implements LoopInterface private $writeListeners = []; private $running; - public function __construct() + public function __construct(EventBaseConfig $config = null) { - $this->eventBase = new EventBase(); + $this->eventBase = new EventBase($config); $this->nextTickQueue = new NextTickQueue($this); $this->futureTickQueue = new FutureTickQueue($this); $this->timerEvents = new SplObjectStorage(); diff --git a/tests/ExtEventLoopTest.php b/tests/ExtEventLoopTest.php index a9570b40..93408ad9 100644 --- a/tests/ExtEventLoopTest.php +++ b/tests/ExtEventLoopTest.php @@ -6,7 +6,7 @@ class ExtEventLoopTest extends AbstractLoopTest { - public function createLoop() + public function createLoop($readStreamCompatible = false) { if ('Linux' === PHP_OS && !extension_loaded('posix')) { $this->markTestSkipped('libevent tests skipped on linux due to linux epoll issues.'); @@ -16,7 +16,13 @@ public function createLoop() $this->markTestSkipped('ext-event tests skipped because ext-event is not installed.'); } - return new ExtEventLoop(); + $cfg = null; + if($readStreamCompatible) { + $cfg = new \EventConfig(); + $cfg->requireFeatures(\EventConfig::FEATURE_FDS); + } + + return new ExtEventLoop($cfg); } public function createStream() @@ -56,4 +62,25 @@ public function writeToStream($stream, $content) fwrite($stream, $content); } + + /** + * @group epoll-readable-error + */ + public function testCanUseReadableStreamWithFeatureFds() + { + $this->loop = $this->createLoop(true); + + $input = fopen('php://temp/maxmemory:0', 'r+'); + + fwrite($input, 'x'); + ftruncate($input, 0); + + $this->loop->addReadStream($input, $this->expectCallableExactly(2)); + + $this->writeToStream($input, "foo\n"); + $this->loop->tick(); + + $this->writeToStream($input, "bar\n"); + $this->loop->tick(); + } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy