diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-03-01 11:34:19 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-03-01 12:04:40 +0000 |
commit | 09c4ae8ed58f4b3803e4ae67b7aedcd15c2ce5ef (patch) | |
tree | aec233b9354719e5802ed68848a2cac0725c8d80 | |
parent | dfa8e27968d5650825b21101f96bd9418af1a5e9 (diff) | |
download | qt-creator-09c4ae8ed58f4b3803e4ae67b7aedcd15c2ce5ef.tar.gz |
QmlProfiler: Limit hard resetting of QML debug connection
On windows it can take a long time to establish the connection. On OSX
we want to throw away the first connection after trying for 200ms. We
don't want to introduce #ifdefs here, so after throwing away two
connections stick to the third one.
Change-Id: I407120244747ac39429786e371c93a7d1e29933d
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp index 49856a52fa..9e3cf9b63b 100644 --- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp @@ -246,14 +246,19 @@ void QmlProfilerClientManager::tryToConnect() d->connectionAttempts = 0; } else if (d->connection && d->connection->socketState() != QAbstractSocket::ConnectedState) { - // Replace the connection after trying for some time. On some operating systems (OSX) the - // very first connection to a TCP server takes a very long time to get established. - - // delete directly here, so that any pending events aren't delivered. We don't want the - // connection first to be established and then torn down again. - delete d->connection; - d->connection = 0; - connectClient(d->tcpPort); + if (d->connectionAttempts < 3) { + // Replace the connection after trying for some time. On some operating systems (OSX) + // the very first connection to a TCP server takes a very long time to get established. + // On other operating systems (Windows) any connection can actually take a long time, + // so after clearing the connection twice, leave it around until the 50 attempts are + // done. + + // delete directly here, so that any pending events aren't delivered. We don't want the + // connection first to be established and then torn down again. + delete d->connection; + d->connection = 0; + connectClient(d->tcpPort); + } connectToClient(); } else if (d->connectionAttempts == 50) { d->connectionTimer.stop(); |