private function clearTimeoutWatcher() { if ($this->timeoutWatcherId !== null) { $this->logger->log(Level::DEBUG, "Cancelling timeout watcher #{$this->timeoutWatcherId}"); cancel($this->timeoutWatcherId); $this->timeoutWatcherId = null; } }
private function closeSocket() { cancel($this->readWatcher); cancel($this->writeWatcher); $this->readWatcher = null; $this->writeWatcher = null; $this->parser->reset(); $this->outputBuffer = ""; $this->outputBufferLength = 0; if (is_resource($this->socket)) { @fclose($this->socket); } foreach ($this->handlers["close"] as $handler) { $handler(); } }
/** * Shut down the mutex client. * * Be sure to release all locks you acquired before, * so other clients will be able to acquire them. * * @return Promise */ public function shutdown() : Promise { cancel($this->watcher); $promises = [$this->std->close()]; foreach ($this->busyConnections as $connection) { $promises[] = $connection->close(); } foreach ($this->readyConnections as list($time, $connection)) { $promises[] = $connection->close(); } return all($promises); }
private static function onEmptyWrite($state) { if (!\is_resource($state->socket) || @\feof($state->socket)) { $state->isDead = true; amp\cancel($state->writeWatcherId); foreach ($state->writeOperations as $op) { $op->promisor->succeed($op->bytesWritten); } $state->writeOperations = []; } }
private function removeScheduledActionsForUnapprovedRoom(Identifier $identifier) { foreach ($this->timerWatchers[$identifier->getIdentString()] ?? [] as $watcherId) { cancel($watcherId); } unset($this->timerWatchers[$identifier->getIdentString()]); }
public function disableForRoom(ChatRoom $room, bool $persist = false) { if (!$this->watchers) { return; } foreach ($this->watchers as $key => $id) { cancel($id); } }
/** * The server will automatically stop listening if this object * is garbage collected. However, socket clients accepted by the * server will not be closed just because the server is unloaded. * Accepted clients must be manually closed or garbage collected. */ public function __destruct() { amp\cancel($this->state->watcherId); }
public function __destruct() { cancel($this->repeatTimer); }