diff --git a/app/backend/nvcomputer.cpp b/app/backend/nvcomputer.cpp index be3f9d29..125943c2 100644 --- a/app/backend/nvcomputer.cpp +++ b/app/backend/nvcomputer.cpp @@ -274,15 +274,26 @@ bool NvComputer::wake() const // Try all unique address strings or host names bool success = false; for (auto i = addressMap.constBegin(); i != addressMap.constEnd(); i++) { - QHostInfo hostInfo = QHostInfo::fromName(i.key()); + QHostAddress literalAddress; + QList addressList; - if (hostInfo.error() != QHostInfo::NoError) { - qWarning() << "Error resolving" << i.key() << ":" << hostInfo.errorString(); - continue; + // If this is an IPv4/IPv6 literal, don't use QHostInfo::fromName() because that will + // try to perform a reverse DNS lookup that leads to delays sending WoL packets. + if (literalAddress.setAddress(i.key())) { + addressList.append(literalAddress); + } + else { + QHostInfo hostInfo = QHostInfo::fromName(i.key()); + if (hostInfo.error() != QHostInfo::NoError) { + qWarning() << "Error resolving" << i.key() << ":" << hostInfo.errorString(); + continue; + } + + addressList.append(hostInfo.addresses()); } // Try all IP addresses that this string resolves to - for (QHostAddress& address : hostInfo.addresses()) { + for (QHostAddress& address : addressList) { QUdpSocket sock; // Send to all static ports