| 1680 | } |
| 1681 | |
| 1682 | void AutomationServer::onDisconnected() |
| 1683 | { |
| 1684 | auto* sock = qobject_cast<QLocalSocket*>(sender()); |
| 1685 | if (!sock) |
| 1686 | return; |
| 1687 | m_buffers.remove(sock); |
| 1688 | if (m_logSubscribers.remove(sock) && m_logSubscribers.isEmpty() && m_logDrain) |
| 1689 | m_logDrain->stop(); |
| 1690 | const auto newEnd = std::remove_if( |
| 1691 | m_connectWaits.begin(), m_connectWaits.end(), |
| 1692 | [sock](const std::shared_ptr<ConnectWait>& wait) { |
| 1693 | if (!wait || wait->socket != sock) { |
| 1694 | return false; |
| 1695 | } |
| 1696 | if (wait->timer) { |
| 1697 | wait->timer->stop(); |
| 1698 | wait->timer->deleteLater(); |
| 1699 | } |
| 1700 | QObject::disconnect(wait->connection); |
| 1701 | wait->complete = true; |
| 1702 | return true; |
| 1703 | }); |
| 1704 | m_connectWaits.erase(newEnd, m_connectWaits.end()); |
| 1705 | sock->deleteLater(); |
| 1706 | qCDebug(lcAutomation) << "client disconnected;" << m_buffers.size() << "active"; |
| 1707 | } |
| 1708 | |
| 1709 | QJsonObject AutomationServer::handleLine(const QByteArray& line, QLocalSocket* sock) |
| 1710 | { |