Commit 05a2bbd7 authored by Philip Müller's avatar Philip Müller

[patch] add missing patch

parent f0c5af5b
From 3935abcd821650620828c44b424398ac363847a7 Mon Sep 17 00:00:00 2001
From: Alexandre Arnt <falso@correio.com>
Date: Wed, 6 Jun 2018 17:03:14 -0300
Subject: [PATCH] - BugFix: Another way to test network connectivity.
---
src/unixcommand.cpp | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp
index 191b818..788c139 100644
--- a/src/unixcommand.cpp
+++ b/src/unixcommand.cpp
@@ -30,7 +30,7 @@
#include <QFileInfo>
#include <QByteArray>
#include <QTextStream>
-#include <QtNetwork/QNetworkInterface>
+#include <QtNetwork>
/*
* Collection of methods to execute many Unix commands
@@ -608,7 +608,23 @@ bool UnixCommand::hasInternetConnection()
*/
bool UnixCommand::doInternetPingTest()
{
- QProcess ping;
+ QTcpSocket socket;
+ QString hostname = "www.google.com";
+
+ socket.connectToHost(hostname, 80);
+ if (socket.waitForConnected(5000))
+ return true;
+ else
+ {
+ hostname = "www.baidu.com";
+ socket.connectToHost(hostname, 80);
+ if (socket.waitForConnected(5000))
+ return true;
+ else
+ return false;
+ }
+
+/* QProcess ping;
int res;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LANG", "C");
@@ -638,6 +654,7 @@ bool UnixCommand::doInternetPingTest()
ping.close();
return (res == 0); //ZERO code means ping was alive!
+*/
}
/*
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment