コード例 #1
0
void DefaultConnection::processConnectionError(const QString &AError)
{
	if (FChangeProxyType && FSocket.proxy().type()==QNetworkProxy::HttpProxy)
	{
		QNetworkProxy socksProxy = FSocket.proxy();
		socksProxy.setType(QNetworkProxy::Socks5Proxy);
		FSocket.setProxy(socksProxy);
		connectSocketToHost(FHost,FPort);
	}
	else if (FRecords.isEmpty())
	{
		if (FSocket.state()!=QSslSocket::ConnectedState || FSSLError)
		{
			setError(AError);
			emit disconnected();
		}
		else
		{
			setError(AError);
		}
	}
	else
	{
		connectToNextHost();
	}
}
コード例 #2
0
ファイル: QXmppTransferManager.cpp プロジェクト: mtdcr/QXmpp
void QXmppTransferIncomingJob::connectToHosts(const QXmppByteStreamIq &iq)
{
    bool check;
    Q_UNUSED(check);

    m_streamCandidates = iq.streamHosts();
    m_streamOfferId = iq.id();
    m_streamOfferFrom = iq.from();

    connectToNextHost();
}
コード例 #3
0
void DefaultConnection::onDnsShutdownFinished()
{
	LogDetail(QString("[DefaultConnection] SRV lookup finished"));
	if (FSrvQueryId != STOP_QUERY_ID)
	{
		FSrvQueryId = START_QUERY_ID;
		connectToNextHost();
	}
	else
	{
		FSrvQueryId = START_QUERY_ID;
		emit disconnected();
	}
}
コード例 #4
0
ファイル: QXmppTransferManager.cpp プロジェクト: mtdcr/QXmpp
void QXmppTransferIncomingJob::_q_candidateDisconnected()
{
    if (!m_candidateClient)
        return;

    warning(QString("Failed to connect to streamhost: %1 (%2:%3)").arg(
            m_candidateHost.jid(),
            m_candidateHost.host().toString(),
            QString::number(m_candidateHost.port())));

    m_candidateClient->deleteLater();
    m_candidateClient = 0;

    // try next host
    connectToNextHost();
}
コード例 #5
0
bool DefaultConnection::connectToHost()
{
	if (FSrvQueryId==START_QUERY_ID && FSocket.state()==QAbstractSocket::UnconnectedState)
	{
		LogDetail(QString("[DefaultConnection] Starting connection"));
		emit aboutToConnect();

		FRecords.clear();
		FSSLError = false;
		FErrorString = QString::null;

		QString host = option(IDefaultConnection::COR_HOST).toString();
		quint16 port = option(IDefaultConnection::COR_PORT).toInt();
		QString domain = option(IDefaultConnection::COR_DOMAINE).toString();
		FSSLConnection = option(IDefaultConnection::COR_USE_SSL).toBool();
		FIgnoreSSLErrors = option(IDefaultConnection::COR_IGNORE_SSL_ERRORS).toBool();
		FChangeProxyType = option(IDefaultConnection::COR_CHANGE_PROXY_TYPE).toBool();

		QJDns::Record record;
		record.name = !host.isEmpty() ? host.toLatin1() : QByteArray("xmpp.rambler.ru");
		record.port = port;
		record.priority = 0;
		record.weight = 0;
		FRecords.append(record);

		if (host.isEmpty() && FDns.init(QJDns::Unicast, QHostAddress::Any))
		{
			LogDetail(QString("[DefaultConnection] Starting SRV lookup on host '%1'").arg(domain));
			FDns.setNameServers(QJDns::systemInfo().nameServers);
			FSrvQueryId = FDns.queryStart(QString("_xmpp-client._tcp.%1.").arg(domain).toLatin1(),QJDns::Srv);
		}
		else
		{
			connectToNextHost();
		}
		return true;
	}
	return false;
}