QmlProfiler: Query available port

Use QTcpServer instead of TcpPortsGatherer.

Change-Id: I12c53ae421fa559a7e71dd5855add2aff00ce33b
Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
This commit is contained in:
Aurindam Jana
2013-04-17 17:58:27 +02:00
parent 4b0f70f4c9
commit bd84ff7189
2 changed files with 8 additions and 14 deletions

View File

@@ -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;