Skip to content

Commit

Permalink
Invoke callback on all non-zero statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed May 24, 2017
1 parent ef6c2b1 commit cd252e4
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/Loop/UvDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,14 @@ public function __construct() {
case 0: // OK
break;

case \UV::EAGAIN: // Resource temporarily unavailable.
default: // Invoke the callback on errors, as this matches behavior with other loop back-ends.
// Re-enable watcher as libuv disables the watcher on non-zero status.
$flags = 0;
foreach ($this->watchers[(int) $event] as $watcher) {
$flags |= $watcher->enabled ? $watcher->type : 0;
}
\uv_poll_start($event, $flags, $this->ioCallback); // Poll must be reactivated.
return;

default: // Disable all related watchers and notify the loop error handler.
foreach ($watchers as $watcher) {
$this->disable($watcher->id);
}
$this->error(new \Error(
\sprintf("UV_%s: %s", \uv_err_name($status), \ucfirst(\uv_strerror($status)))
));
return;
\uv_poll_start($event, $flags, $this->ioCallback);
break;
}

foreach ($watchers as $watcher) {
Expand Down

0 comments on commit cd252e4

Please sign in to comment.