10000 Documentation for advanced stream API by clue · Pull Request #110 · reactphp/event-loop · GitHub
[go: up one dir, main page]

Skip to content

Documentation for advanced stream API #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 14, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unneeded and undocumented loop argument for stream listeners
  • Loading branch information
clue committed Oct 13, 2017
commit 8997565319b8aceea8ae6300f3c0930bf0ed0fff
4 changes: 2 additions & 2 deletions src/ExtEventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@ private function createStreamCallback()
$key = (int) $stream;

if (Event::READ === (Event::READ & $flags) && isset($this->readListeners[$key])) {
call_user_func($this->readListeners[$key], $stream, $this);
call_user_func($this->readListeners[$key], $stream);
}

if (Event::WRITE === (Event::WRITE & $flags) && isset($this->writeListeners[$key])) {
call_user_func($this->writeListeners[$key], $stream, $this);
call_user_func($this->writeListeners[$key 8000 ], $stream);
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/LibEvLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function addReadStream($stream, callable $listener)
}

$callback = function () use ($stream, $listener) {
call_user_func($listener, $stream, $this);
call_user_func($listener, $stream);
};

$event = new IOEvent($callback, $stream, IOEvent::READ);
Expand All @@ -59,7 +59,7 @@ public function addWriteStream($stream, callable $listener)
}

$callback = function () use ($stream, $listener) {
call_user_func($listener, $stream, $this);
call_user_func($listener, $stream);
};

$event = new IOEvent($callback, $stream, IOEvent::WRITE);
Expand Down
4 changes: 2 additions & 2 deletions src/LibEventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ private function createStreamCallback()
$key = (int) $stream;

if (EV_READ === (EV_READ & $flags) && isset($this->readListeners[$key])) {
call_user_func($this->readListeners[$key], $stream, $this);
call_user_func($this->readListeners[$key], $stream);
}

if (EV_WRITE === (EV_WRITE & $flags) && isset($this->writeListeners[$key])) {
call_user_func($this->writeListeners[$key], $stream, $this);
call_user_func($this->writeListeners[$key], $stream);
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/StreamSelectLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ private function waitForStreamActivity($timeout)
$key = (int) $stream;

if (isset($this->readListeners[$key])) {
call_user_func($this->readListeners[$key], $stream, $this);
call_user_func($this->readListeners[$key], $stream);
}
}

foreach ($write as $stream) {
$key = (int) $stream;

if (isset($this->writeListeners[$key])) {
call_user_func($this->writeListeners[$key], $stream, $this);
call_user_func($this->writeListeners[$key], $stream);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/StreamSelectLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ public function testSignalInterruptWithStream($signal)

// add stream to the loop
list($writeStream, $readStream) = $this->createSocketPair();
$this->loop->addReadStream($readStream, function($stream, $loop) {
$this->loop->addReadStream($readStream, function ($stream) {
/** @var $loop LoopInterface */
$read = fgets($stream);
if ($read === "end loop\n") {
$loop->stop();
$this->loop->stop();
}
});
$this->loop->addTimer(0.05, function() use ($writeStream) {
Expand Down
0