forked from qt-creator/qt-creator
Valgrind: Query available port
Use QTcpServer instead of TcpPortsGatherer. Change-Id: I270a5a9464b2cec48b7e2da2772c8a042bf71d95 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
This commit is contained in:
@@ -37,10 +37,11 @@
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <utils/tcpportsgatherer.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QTcpServer>
|
||||
|
||||
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<RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
|
Reference in New Issue
Block a user