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/kitinformation.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <utils/tcpportsgatherer.h>
|
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QTcpServer>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace RemoteLinux;
|
using namespace RemoteLinux;
|
||||||
|
|
||||||
@@ -77,13 +78,10 @@ Analyzer::AnalyzerStartParameters ValgrindTool::createStartParameters(
|
|||||||
const ProjectExplorer::IDevice::ConstPtr device =
|
const ProjectExplorer::IDevice::ConstPtr device =
|
||||||
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
|
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
|
||||||
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return sp);
|
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return sp);
|
||||||
Utils::TcpPortsGatherer portsGatherer;
|
QTcpServer server;
|
||||||
portsGatherer.update(QAbstractSocket::UnknownNetworkLayerProtocol);
|
if (!server.listen(QHostAddress(sp.connParams.host)))
|
||||||
Utils::PortList portList = device->freePorts();
|
|
||||||
int freePort = portsGatherer.getNextFreePort(&portList);
|
|
||||||
if (freePort == -1)
|
|
||||||
return sp;
|
return sp;
|
||||||
sp.connParams.port = freePort;
|
sp.connParams.port = server.serverPort();
|
||||||
sp.startMode = Analyzer::StartLocal;
|
sp.startMode = Analyzer::StartLocal;
|
||||||
} else if (RemoteLinuxRunConfiguration *rc2 =
|
} else if (RemoteLinuxRunConfiguration *rc2 =
|
||||||
qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||||
|
Reference in New Issue
Block a user