8000 Fix LibEvLoop to ignore double IO streams · reactphp/event-loop@b2acd81 · GitHub
[go: up one dir, main page]

Skip to content

Commit b2acd81

Browse files
committed
Fix LibEvLoop to ignore double IO streams
1 parent 7dc3006 commit b2acd81

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/LibEvLoop.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public function __construct()
3838
*/
3939
public function addReadStream($stream, callable $listener)
4040
{
41+
if (isset($this->readEvents[(int) $stream])) {
42+
return;
43+
}
44+
4145
$callback = function () use ($stream, $listener) {
4246
call_user_func($listener, $stream, $this);
4347
};
@@ -53,6 +57,10 @@ public function addReadStream($stream, callable $listener)
5357
*/
5458
public function addWriteStream($stream, callable $listener)
5559
{
60+
if (isset($this->writeEvents[(int) $stream])) {
61+
return;
62+
}
63+
5664
$callback = function () use ($stream, $listener) {
5765
call_user_func($listener, $stream, $this);
5866
};

0 commit comments

Comments
 (0)
0