public function close() { if (isset($this->ev)) { $this->ev = null; } if ($this->pid !== posix_getpid()) { // preventing closing pre-bound sockets in workers return; } if (is_resource($this->fd)) { socket_close($this->fd); } }