Avoid long "hanging" if Windows UNC path is not reachable

Use own "isDirExisting" function checking UNC paths
This commit is contained in:
Klaus Basan
2018-03-08 18:48:14 +01:00
parent 32196f5e8e
commit 42ef7c5633
8 changed files with 120 additions and 13 deletions

View File

@@ -74,7 +74,14 @@ namespace BlackMisc
}
process.start();
process.waitForFinished();
return process.exitCode() == 0;
const int rc = process.exitCode();
if (rc != 0) { return false; }
const QString std = process.readAllStandardOutput();
const QString err = process.readAllStandardError();
if (std.contains("unreachable", Qt::CaseInsensitive)) { return false; }
if (err.contains("unreachable", Qt::CaseInsensitive)) { return false; }
return true;
}
bool CNetworkUtils::canPing(const CUrl &url)
@@ -92,7 +99,7 @@ namespace BlackMisc
if (address.isNull()) { continue; }
if (address.protocol() == QAbstractSocket::IPv4Protocol)
{
QString a = address.toString();
const QString a = address.toString();
ips.append(a);
}
}