Commit 4ec63a71 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

QML debugger: Fix remote debugging with port forwarding involved.



Full explanation inside.

Change-Id: Ib39f18282b7d78ebdab53ac2ebe9d4cf1e11c008
Reviewed-by: default avatarAurindam Jana <aurindam.jana@digia.com>
parent 35211c04
......@@ -413,18 +413,24 @@ void QmlEngine::beginConnection(quint16 port)
if (host.isEmpty())
host = QLatin1String("localhost");
if (port > 0) {
QTC_ASSERT(startParameters().connParams.port == 0
|| startParameters().connParams.port == port,
qWarning() << "Port " << port << "from application output does not match"
<< startParameters().connParams.port << "from start parameters.");
m_adapter.beginConnectionTcp(host, port);
return;
}
// no port from application output, use the one from start parameters ...
m_adapter.beginConnectionTcp(host, startParameters().qmlServerPort);
/*
* Let plugin-specific code override the port printed by the application. This is necessary
* in the case of port forwarding, when the port the application listens on is not the same that
* we want to connect to.
* NOTE: It is still necessary to wait for the output in that case, because otherwise we cannot
* be sure that the port is already open. The usual method of trying to connect repeatedly
* will not work, because the intermediate port is already open. So the connection
* will be accepted on that port but the forwarding to the target port will fail and
* the connection will be closed again (instead of returning the "connection refused"
* error that we expect).
*/
if (startParameters().qmlServerPort > 0)
port = startParameters().qmlServerPort;
m_adapter.beginConnectionTcp(host, port);
}
void QmlEngine::connectionStartupFailed()
{
if (m_retryOnConnectFail) {
......
Markdown is supported
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