diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2016-03-30 11:35:41 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2016-04-03 13:24:43 +0000 |
commit | a7b04275082d065f392e7f18c54ea9b41507ae40 (patch) | |
tree | 9f2639181d8f6871ea1184debccb7b46b7062e79 /src | |
parent | 5cbc4609906bbd0484344f96643840ffdc723d69 (diff) |
QAbstractSocket: simplify connect timer handling
Remove:
- handling in abort(): timer will be stopped in resetSocketLayer();
- unneccesary checks in _q_testConnection(): if we have a valid timer
we should stop it anyway;
- code duplication in _q_testConnection(): do not try to stop the
timer twice.
Change-Id: I039ae583ae4e6c4a90dc102c7d93a30e46632374
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/socket/qabstractsocket.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 3ce2d63a39..731afd4e36 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1135,12 +1135,10 @@ void QAbstractSocketPrivate::_q_connectToNextAddress() */ void QAbstractSocketPrivate::_q_testConnection() { - if (socketEngine) { - if (threadData->hasEventDispatcher()) { - if (connectTimer) - connectTimer->stop(); - } + if (connectTimer) + connectTimer->stop(); + if (socketEngine) { if (socketEngine->state() == QAbstractSocket::ConnectedState) { // Fetch the parameters if our connection is completed; // otherwise, fall out and try the next address. @@ -1157,11 +1155,6 @@ void QAbstractSocketPrivate::_q_testConnection() addresses.clear(); } - if (threadData->hasEventDispatcher()) { - if (connectTimer) - connectTimer->stop(); - } - #if defined(QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::_q_testConnection() connection failed," " checking for alternative addresses"); @@ -2370,11 +2363,6 @@ void QAbstractSocket::abort() return; } #endif - if (d->connectTimer) { - d->connectTimer->stop(); - delete d->connectTimer; - d->connectTimer = 0; - } d->abortCalled = true; close(); |