Skip to content

Commit 94ef249

Browse files
kelunikjsor
authored andcommitted
Fix LibEvLoop to ignore double IO streams
1 parent a86fae2 commit 94ef249

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/LibEvLoop.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public function __construct()
3535
*/
3636
public function addReadStream($stream, callable $listener)
3737
{
38+
if (isset($this->readEvents[(int) $stream])) {
39+
return;
40+
}
41+
3842
$callback = function () use ($stream, $listener) {
3943
call_user_func($listener, $stream, $this);
4044
};
@@ -50,6 +54,10 @@ public function addReadStream($stream, callable $listener)
5054
*/
5155
public function addWriteStream($stream, callable $listener)
5256
{
57+
if (isset($this->writeEvents[(int) $stream])) {
58+
return;
59+
}
60+
5361
$callback = function () use ($stream, $listener) {
5462
call_user_func($listener, $stream, $this);
5563
};

0 commit comments

Comments
 (0)