- $this->ios[(int) $socket] = new EvIo($socket, $ev, function($watcher, $events) use($socket) {
- $action = 0;
- if ($events & Ev::READ) {
- $action |= self::POLL_IN;
- }
- if ($events & Ev::WRITE) {
- $action |= self::POLL_OUT;
- }
- if (!call_user_func($this->run, $this->client, $socket, $action)) {
- if ($this->timeout) {
- $this->timeout->stop();
- $this->timeout = null;
- }
- }
- });
+ $this->ios[(int) $socket] = new Event($this->evbase,
+ $socket, $ev, $this->onEvent($socket));