void DefaultConnection::disconnectFromHost()
{
	FRecords.clear();
	if (FSocket.state() != QSslSocket::UnconnectedState)
	{
		if (FSocket.state() == QSslSocket::ConnectedState)
		{
			LogDetail(QString("[DefaultConnection] Starting socket disconnection from host"));
			emit aboutToDisconnect();
			FSocket.flush();
			FSocket.disconnectFromHost();
		}
		else
		{
			LogError(QString("[DefaultConnection] Aborting socket connection to host"));
			FSocket.abort();
			emit disconnected();
		}
	}
	else if (FSrvQueryId != START_QUERY_ID)
	{
		LogDetail(QString("[DefaultConnection] Shutdown SRV lookup"));
		FSrvQueryId = STOP_QUERY_ID;
		FDns.shutdown();
	}

	if (FSocket.state()!=QSslSocket::UnconnectedState && !FSocket.waitForDisconnected(DISCONNECT_TIMEOUT))
	{
		LogError(QString("[DefaultConnection] Disconnection timed out"));
		setError(tr("Disconnection timed out"));
		emit disconnected();
	}
}
Esempio n. 2
0
void KMessageClient::removeBrokenConnection2 ()
{
  qCDebug(GAMES_PRIVATE_KGAME) << ": Broken:Deleting the connection object"<<this;

  emit aboutToDisconnect(id());
  delete d->connection;
  d->connection = 0;
  d->adminID = 0;
  emit connectionBroken();
  qCDebug(GAMES_PRIVATE_KGAME) << ": Broken:Deleting the connection object DONE";
}
Esempio n. 3
0
void KMessageClient::disconnect ()
{
  qCDebug(GAMES_PRIVATE_KGAME) << ": Disconnect:Deleting the connection object";

  emit aboutToDisconnect(id());
  delete d->connection;
  d->connection = 0;
  d->adminID = 0;
  emit connectionBroken();
  qCDebug(GAMES_PRIVATE_KGAME) << ": Disconnect:Deleting the connection object DONE";
}
Esempio n. 4
0
void KMessageClient::disconnect ()
{
  kdDebug (11001) << k_funcinfo << ": Disconnect:Deleting the connection object" << endl;

  emit aboutToDisconnect(id());
  delete d->connection;
  d->connection = 0;
  d->adminID = 0;
  emit connectionBroken();
  kdDebug (11001) << k_funcinfo << ": Disconnect:Deleting the connection object DONE" << endl;
}
Esempio n. 5
0
bool AbstractDb::close()
{
    bool deny = false;
    emit aboutToDisconnect(deny);
    if (deny)
        return false;

    bool res = !isOpen() || closeQuiet();
    if (res)
        emit disconnected();

    return res;
}