server = $server; $this->fd = $fd; } /** * @inheritDoc * @throws AnnotationException */ public function onActivate() { ZMUtil::checkWait(); ConnectionManager::close($this->fd); set_coroutine_params(["server" => $this->server, "fd" => $this->fd]); foreach(ZMBuf::$events[SwooleEventAt::class] ?? [] as $v) { if(strtolower($v->type) == "close" && $this->parseSwooleRule($v)) { $c = $v->class; EventHandler::callWithMiddleware($c, $v->method, ["server" => $this->server, "fd" => $this->fd], []); if(context()->getCache("block_continue") === true) break; } } return $this; } /** * @inheritDoc * @throws AnnotationException */ public function onAfter() { foreach (ZMBuf::$events[SwooleEventAfter::class] ?? [] as $v) { if (strtolower($v->type) == "close" && $this->parseSwooleRule($v) === true) { $c = $v->class; EventHandler::callWithMiddleware($c, $v->method, ["server" => $this->server, "fd" => $this->fd], []); if(context()->getCache("block_continue") === true) break; } } return $this; } private function parseSwooleRule($v) { return true; } }