diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-08-11 11:38:12 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-09-07 08:26:39 +0000 |
commit | 6a2e11940f8c5d9c5d99709cab85328e1817fca2 (patch) | |
tree | af026a873af62643c73cc80f10cb509b82be15d0 /src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp | |
parent | 34baa3ec472032428cd01b80692bd69126cb324a (diff) |
QmlProfiler: Start connection timer before connection
The QmlDebugConnection might immediately signal a connection failure
on connectToHost() or startLocalServer(). If the timer is not running
then, we trigger the QTC_ASSERT in qmlDebugConnectionFailed(), which is
meant to make sure that we don't silently give up. In this case, we
haven't even given up, yet, as the timer is in fact started afterwards.
Change-Id: Ia2c107d9b511092eaf32380203a3b4628139d320
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp index 779a999ee5..ca9fd79164 100644 --- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp @@ -104,13 +104,6 @@ void QmlProfilerClientManager::clearBufferedData() void QmlProfilerClientManager::connectToTcpServer() { - if (m_connection.isNull()) { - QTC_ASSERT(m_qmlclientplugin.isNull(), disconnectClient()); - createConnection(); - QTC_ASSERT(m_connection, emit connectionFailed(); return); - m_connection->connectToHost(m_tcpHost, m_tcpPort.number()); - } - // Calling this again when we're already trying means "reset the retry timer". This is // useful in cases where we have to parse the port from the output. We might waste retries // on an initial guess for the port. @@ -144,18 +137,17 @@ void QmlProfilerClientManager::connectToTcpServer() } }); m_connectionTimer.start(m_retryInterval); -} -void QmlProfilerClientManager::startLocalServer() -{ if (m_connection.isNull()) { - // Otherwise, reuse the same one QTC_ASSERT(m_qmlclientplugin.isNull(), disconnectClient()); createConnection(); QTC_ASSERT(m_connection, emit connectionFailed(); return); - m_connection->startLocalServer(m_localSocket); + m_connection->connectToHost(m_tcpHost, m_tcpPort.number()); } +} +void QmlProfilerClientManager::startLocalServer() +{ stopConnectionTimer(); connect(&m_connectionTimer, &QTimer::timeout, this, [this]() { QTC_ASSERT(!isConnected(), return); @@ -171,6 +163,14 @@ void QmlProfilerClientManager::startLocalServer() } }); m_connectionTimer.start(m_retryInterval); + + if (m_connection.isNull()) { + // Otherwise, reuse the same one + QTC_ASSERT(m_qmlclientplugin.isNull(), disconnectClient()); + createConnection(); + QTC_ASSERT(m_connection, emit connectionFailed(); return); + m_connection->startLocalServer(m_localSocket); + } } void QmlProfilerClientManager::stopRecording() |