Skip to content

Commit

Permalink
Fix swoole event
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor committed Nov 7, 2024
1 parent 25a8202 commit 842c353
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Events/Swoole.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ public function onWritable($stream, callable $func): void
if (!isset($this->readEvents[$fd]) && !isset($this->writeEvents[$fd])) {
Event::add($stream, null, fn () => $this->callWrite($fd), SWOOLE_EVENT_WRITE);
} elseif (isset($this->readEvents[$fd])) {
Event::set($stream, null, fn () => $this->callWrite($func, [$stream]), SWOOLE_EVENT_WRITE | SWOOLE_EVENT_READ);
Event::set($stream, null, fn () => $this->callWrite($fd), SWOOLE_EVENT_WRITE | SWOOLE_EVENT_READ);
} else {
Event::set($stream, null, fn () => $this->callWrite($func, [$stream]), SWOOLE_EVENT_WRITE);
Event::set($stream, null, fn () =>$this->callWrite($fd), SWOOLE_EVENT_WRITE);
}

$this->writeEvents[$fd] = [$func, [$stream]];
Expand Down

0 comments on commit 842c353

Please sign in to comment.