From 17a26e008ab2702a86055036904e058eff07ff19 Mon Sep 17 00:00:00 2001 From: Aurindam Jana Date: Wed, 17 Apr 2013 18:00:51 +0200 Subject: [PATCH] Valgrind: Query available port Use QTcpServer instead of TcpPortsGatherer. Change-Id: I270a5a9464b2cec48b7e2da2772c8a042bf71d95 Reviewed-by: Christiaan Janssen --- src/plugins/valgrind/valgrindtool.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/valgrind/valgrindtool.cpp b/src/plugins/valgrind/valgrindtool.cpp index 793313397e1..584a80cc95b 100644 --- a/src/plugins/valgrind/valgrindtool.cpp +++ b/src/plugins/valgrind/valgrindtool.cpp @@ -37,10 +37,11 @@ #include #include #include -#include #include +#include + using namespace ProjectExplorer; using namespace RemoteLinux; @@ -77,13 +78,10 @@ Analyzer::AnalyzerStartParameters ValgrindTool::createStartParameters( const ProjectExplorer::IDevice::ConstPtr device = ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit()); QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return sp); - 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 = Analyzer::StartLocal; } else if (RemoteLinuxRunConfiguration *rc2 = qobject_cast(runConfiguration)) {