winrt: DNS lookup: don't have duplicate entries

Change-Id: I60ee29bd692f8e385080d4532a0e3230942a2cd3
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
This commit is contained in:
Oliver Wolff 2014-05-07 09:24:04 +02:00
parent 83f06da1c6
commit 2ddc0fcd9b

View File

@ -120,6 +120,8 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
unsigned int size;
endpointPairs->get_Size(&size);
// endpoint pairs might contain duplicates so we temporarily store addresses in a QSet
QSet<QHostAddress> addresses;
for (unsigned int i = 0; i < size; ++i) {
IEndpointPair *endpointpair;
endpointPairs->GetAt(i, &endpointpair);
@ -139,9 +141,12 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
remoteHost->Release();
UINT32 length;
PCWSTR rawString = name.GetRawBuffer(&length);
addresses.insert(QHostAddress(QString::fromWCharArray(rawString, length)));
}
foreach (const QHostAddress &address, addresses) {
QDnsHostAddressRecord record;
record.d->name = aceHostname;
record.d->value = QHostAddress(QString::fromWCharArray(rawString, length));
record.d->value = address;
reply->hostAddressRecords.append(record);
}
}