Skip to content

Commit

Permalink
Fix notices in NativeReactor; prepare tag 1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoebi committed May 12, 2016
1 parent 87a5f29 commit 4f2161d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 1.2.2

- Fix notice in NativeReactor when removing a handle while
an event is waiting for it. (Regression fix from 1.1.1)

### 1.2.1

- Fix uv_run() potentially exiting earlier than intended,
Expand Down
13 changes: 9 additions & 4 deletions lib/NativeReactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,21 @@ private function selectActionableStreams($timeout) {
if (!@stream_select($r, $w, $e, $sec, $usec)) {
return;
}
// check for if (!empty($watchers[$streamId])) as they may have been removed during another callback
foreach ($r as $stream) {
$streamId = (int) $stream;
foreach ($this->readWatchers[$streamId] as $watcherId => $watcher) {
$this->doIoCallback($watcherId, $watcher, $stream);
if (!empty($this->readWatchers[$streamId])) {
foreach ($this->readWatchers[$streamId] as $watcherId => $watcher) {
$this->doIoCallback($watcherId, $watcher, $stream);
}
}
}
foreach ($w as $stream) {
$streamId = (int) $stream;
foreach ($this->writeWatchers[$streamId] as $watcherId => $watcher) {
$this->doIoCallback($watcherId, $watcher, $stream);
if (!empty($this->writeWatchers[$streamId])) {
foreach ($this->writeWatchers[$streamId] as $watcherId => $watcher) {
$this->doIoCallback($watcherId, $watcher, $stream);
}
}
}
}
Expand Down

0 comments on commit 4f2161d

Please sign in to comment.