protected getEndCallback ( Phergie\Irc\Client\React\ReadStream $read, Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection, React\EventLoop\Timer\TimerInterface $timer ) : callable | ||
$read | Phergie\Irc\Client\React\ReadStream | Read stream for this connection |
$write | Phergie\Irc\Client\React\WriteStream | Write stream for this connection |
$connection | Phergie\Irc\ConnectionInterface | Terminated connection |
$timer | React\EventLoop\Timer\TimerInterface | Timer used to handle asynchronously queued events on the connection, which must be cancelled |
return | callable |
protected function getEndCallback(ReadStream $read, WriteStream $write, ConnectionInterface $connection, TimerInterface $timer)
{
$logger = $this->getLogger();
return function () use($read, $write, $connection, $timer, $logger) {
$this->removeActiveConnection($connection);
$this->emit('connect.end', array($connection, $logger));
$this->cancelTimer($timer);
$connection->clearData();
$read->close();
$write->close();
};
}