Do not use the default proxy.

Qt uses the system proxy if set up, explicitly disable it.

BUG: 376187
This commit is contained in:
Albert Vaca 2017-03-06 22:01:46 +01:00
parent 5dfafab10b
commit a4f2a60d47

View file

@ -30,6 +30,7 @@
#include <QHostInfo> #include <QHostInfo>
#include <QTcpServer> #include <QTcpServer>
#include <QNetworkProxy>
#include <QUdpSocket> #include <QUdpSocket>
#include <QNetworkSession> #include <QNetworkSession>
#include <QNetworkConfigurationManager> #include <QNetworkConfigurationManager>
@ -55,8 +56,11 @@ LanLinkProvider::LanLinkProvider(bool testMode)
connect(&mUdpSocket, &QIODevice::readyRead, this, &LanLinkProvider::newUdpConnection); connect(&mUdpSocket, &QIODevice::readyRead, this, &LanLinkProvider::newUdpConnection);
mServer = new Server(this); mServer = new Server(this);
mServer->setProxy(QNetworkProxy::NoProxy);
connect(mServer,&QTcpServer::newConnection,this, &LanLinkProvider::newConnection); connect(mServer,&QTcpServer::newConnection,this, &LanLinkProvider::newConnection);
mUdpSocket.setProxy(QNetworkProxy::NoProxy);
//Detect when a network interface changes status, so we announce ourelves in the new network //Detect when a network interface changes status, so we announce ourelves in the new network
QNetworkConfigurationManager* networkManager = new QNetworkConfigurationManager(this); QNetworkConfigurationManager* networkManager = new QNetworkConfigurationManager(this);
connect(networkManager, &QNetworkConfigurationManager::configurationChanged, this, &LanLinkProvider::onNetworkConfigurationChanged); connect(networkManager, &QNetworkConfigurationManager::configurationChanged, this, &LanLinkProvider::onNetworkConfigurationChanged);
@ -135,6 +139,7 @@ void LanLinkProvider::broadcastToNetwork()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
//On Windows we need to broadcast from every local IP address to reach all networks //On Windows we need to broadcast from every local IP address to reach all networks
QUdpSocket sendSocket; QUdpSocket sendSocket;
sendSocket.setProxy(QNetworkProxy::NoProxy);
for (const QNetworkInterface &iface : QNetworkInterface::allInterfaces()) { for (const QNetworkInterface &iface : QNetworkInterface::allInterfaces()) {
if ( (iface.flags() & QNetworkInterface::IsUp) if ( (iface.flags() & QNetworkInterface::IsUp)
&& (iface.flags() & QNetworkInterface::IsRunning) && (iface.flags() & QNetworkInterface::IsRunning)
@ -194,6 +199,7 @@ void LanLinkProvider::newUdpConnection() //udpBroadcastReceived
//qCDebug(KDECONNECT_CORE) << "Received Udp identity package from" << sender << " asking for a tcp connection on port " << tcpPort; //qCDebug(KDECONNECT_CORE) << "Received Udp identity package from" << sender << " asking for a tcp connection on port " << tcpPort;
QSslSocket* socket = new QSslSocket(this); QSslSocket* socket = new QSslSocket(this);
socket->setProxy(QNetworkProxy::NoProxy);
receivedIdentityPackages[socket].np = receivedPackage; receivedIdentityPackages[socket].np = receivedPackage;
receivedIdentityPackages[socket].sender = sender; receivedIdentityPackages[socket].sender = sender;
connect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::connected); connect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::connected);
@ -464,6 +470,8 @@ void LanLinkProvider::configureSslSocket(QSslSocket* socket, const QString& devi
void LanLinkProvider::configureSocket(QSslSocket* socket) { void LanLinkProvider::configureSocket(QSslSocket* socket) {
socket->setProxy(QNetworkProxy::NoProxy);
socket->setSocketOption(QAbstractSocket::KeepAliveOption, QVariant(1)); socket->setSocketOption(QAbstractSocket::KeepAliveOption, QVariant(1));
#ifdef TCP_KEEPIDLE #ifdef TCP_KEEPIDLE