mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
ServerResolver: fix bug where ServerResolver_qt5 would always pass on the original port given to the resolver.
Instead of using the port from the QDnsServiceRecord, the srvResolved() slot used m_origPort. Oops. Fixes mumble-voip/mumble#3267
This commit is contained in:
parent
fba1d65b3e
commit
04a8a5db81
@ -98,7 +98,7 @@ void ServerResolverPrivate::hostResolved(QHostInfo hostInfo) {
|
||||
}
|
||||
|
||||
qint64 priority = normalizeSrvPriority(record.priority(), record.weight());
|
||||
m_resolved << ServerResolverRecord(m_origHostname, m_origPort, priority, addresses);
|
||||
m_resolved << ServerResolverRecord(m_origHostname, record.port(), priority, addresses);
|
||||
}
|
||||
|
||||
m_srvQueueRemain -= 1;
|
||||
|
||||
@ -25,6 +25,7 @@ class TestServerResolver : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void simpleSrv();
|
||||
void srvCustomPort();
|
||||
void simpleA();
|
||||
void simpleAAAA();
|
||||
void simpleCNAME();
|
||||
@ -77,6 +78,53 @@ void TestServerResolver::simpleSrv() {
|
||||
QVERIFY(hasipv4 || hasipv6);
|
||||
}
|
||||
|
||||
void TestServerResolver::srvCustomPort() {
|
||||
#ifdef USE_NO_SRV
|
||||
return;
|
||||
#endif
|
||||
|
||||
ServerResolver r;
|
||||
QSignalSpy spy(&r, SIGNAL(resolved()));
|
||||
|
||||
QString hostname = QString::fromLatin1("customport.serverresolver.mumble.info");
|
||||
quint16 customPort = 36001;
|
||||
r.resolve(hostname, 64738);
|
||||
|
||||
signalSpyWait(spy);
|
||||
|
||||
QCOMPARE(spy.count(), 1);
|
||||
|
||||
QList<ServerResolverRecord> records = r.records();
|
||||
QCOMPARE(records.size(), 1);
|
||||
|
||||
ServerResolverRecord record = records.at(0);
|
||||
QCOMPARE(record.hostname(), hostname);
|
||||
QCOMPARE(record.port(), customPort);
|
||||
// Allow 1 or 2 results. The answer depends on whether
|
||||
// the system supports IPv4, IPv6, or both.
|
||||
QVERIFY(record.addresses().size() == 1 || record.addresses().size() == 2);
|
||||
QCOMPARE(record.priority(), 65545); // priority=1, weight=10 -> 1 * 65535 + 10
|
||||
|
||||
bool hasipv4 = false;
|
||||
bool hasipv6 = false;
|
||||
|
||||
HostAddress v4(QHostAddress(QLatin1String("127.0.0.1")));
|
||||
HostAddress v6(QHostAddress(QLatin1String("::1")));
|
||||
|
||||
foreach (HostAddress ha, record.addresses()) {
|
||||
if (ha == v4) {
|
||||
hasipv4 = true;
|
||||
}
|
||||
if (ha == v6) {
|
||||
hasipv6 = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Require either an IPv4 match, or an IPv6 match.
|
||||
QVERIFY(hasipv4 || hasipv6);
|
||||
}
|
||||
|
||||
|
||||
void TestServerResolver::simpleCNAME() {
|
||||
ServerResolver r;
|
||||
QSignalSpy spy(&r, SIGNAL(resolved()));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user