Commit bd84ff71 authored by Aurindam Jana's avatar Aurindam Jana
Browse files

QmlProfiler: Query available port



Use QTcpServer instead of TcpPortsGatherer.

Change-Id: I12c53ae421fa559a7e71dd5855add2aff00ce33b
Reviewed-by: default avatarChristiaan Janssen <christiaan.janssen@digia.com>
parent 4b0f70f4
......@@ -47,11 +47,11 @@
#include <projectexplorer/localapplicationrunconfiguration.h>
#include <qmldebug/qmloutputparser.h>
#include <remotelinux/remotelinuxrunconfiguration.h>
#include <utils/tcpportsgatherer.h>
#include <QMainWindow>
#include <QMessageBox>
#include <QTimer>
#include <QTcpServer>
using namespace Analyzer;
using namespace ProjectExplorer;
......@@ -121,13 +121,10 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
const ProjectExplorer::IDevice::ConstPtr device =
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
Utils::TcpPortsGatherer portsGatherer;
portsGatherer.update(QAbstractSocket::UnknownNetworkLayerProtocol);
Utils::PortList portList = device->freePorts();
int freePort = portsGatherer.getNextFreePort(&portList);
if (freePort == -1)
QTcpServer server;
if (!server.listen(QHostAddress(QLatin1String("127.0.0.1"))))
return 0;
conf.port = freePort;
conf.port = server.serverPort();
runner = new LocalQmlProfilerRunner(conf, parent);
}
return runner;
......
......@@ -48,7 +48,6 @@
#include <utils/fancymainwindow.h>
#include <utils/fileinprojectfinder.h>
#include <utils/qtcassert.h>
#include <utils/tcpportsgatherer.h>
#include <projectexplorer/environmentaspect.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h>
......@@ -85,6 +84,7 @@
#include <QMenu>
#include <QTimer>
#include <QTime>
#include <QTcpServer>
using namespace Core;
using namespace Core::Constants;
......@@ -343,13 +343,10 @@ AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration
const ProjectExplorer::IDevice::ConstPtr device =
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
Utils::TcpPortsGatherer portsGatherer;
portsGatherer.update(QAbstractSocket::UnknownNetworkLayerProtocol);
Utils::PortList portList = device->freePorts();
int freePort = portsGatherer.getNextFreePort(&portList);
if (freePort == -1)
QTcpServer server;
if (!server.listen(QHostAddress(sp.connParams.host)))
return sp;
sp.connParams.port = freePort;
sp.connParams.port = server.serverPort();
}
sp.startMode = StartQml;
return sp;
......
Supports Markdown
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