Ejemplo n.º 1
0
void AbstractLink::socketDisconnected()
{
    LOG_AS("AbstractLink");

    if (d->status == Connecting)
    {
        if (d->startedTryingAt.since() < d->timeout)
        {
            // Let's try again a bit later.
            QTimer::singleShot(500, d->socket.get(), SLOT(reconnect()));
            return;
        }
        d->socket->setQuiet(false);
    }
    else
    {
        if (!d->peerAddress.isNull())
        {
            LOG_NET_NOTE("Disconnected from %s") << d->peerAddress;
        }
        else
        {
            LOG_NET_NOTE("Disconnected");
        }
    }

    d->status = Disconnected;

    emit disconnected();

    // Slots have now had an opportunity to observe the total
    // duration of the connection that has just ended.
    d->connectedAt = Time::invalidTime();
}
Ejemplo n.º 2
0
void LocalServer::stop()
{
    if (isRunning())
    {
        LOG_NET_NOTE("Stopping local server on port %i") << d->port;
        d->proc->kill();
    }
}