예제 #1
0
void DirectConnectionPrivate::lookupResultsReady()
{
	QDnsLookup *dns = qobject_cast<QDnsLookup*>(sender());
	dns->deleteLater();
	Q_ASSERT(dns);

	QList<QDnsServiceRecord> results = dns->serviceRecords();
	dns_records.clear();

	if (results.isEmpty()) {
		Record record;
		record.host = host_name;
		dns_records << record;
	} else {
		foreach (const QDnsServiceRecord &result, results) {
			Record record;
			record.host = result.target();
			// may be it's a reason of connection problems of some users
			if (record.host.endsWith(QLatin1Char('.')))
				record.host.chop(1);
			record.port = result.port();
			record.weight = result.weight();
			record.priority = result.priority();
			dns_records << record;
		}
	}
예제 #2
0
void EwsEngine::checkDNSFinished()
{
    QDnsLookup *dns = qobject_cast<QDnsLookup*>(sender());
    qDebug() << Q_FUNC_INFO << dns << dns->name() << dns->error() << dns->errorString();
    if (dns->property("host").toString() == m_internalUri.host()) {
        if (dns->error()) {
            m_connection->setUri(m_externalUri);
            update();
        }
    } else {
        if (dns->error()) {
            m_connection->setUri(m_internalUri);
            update();
        }
    }
    dns->deleteLater();
}