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>
This commit is contained in:
parent
5cbc460990
commit
a7b0427508
@ -1135,12 +1135,10 @@ void QAbstractSocketPrivate::_q_connectToNextAddress()
|
|||||||
*/
|
*/
|
||||||
void QAbstractSocketPrivate::_q_testConnection()
|
void QAbstractSocketPrivate::_q_testConnection()
|
||||||
{
|
{
|
||||||
if (socketEngine) {
|
|
||||||
if (threadData->hasEventDispatcher()) {
|
|
||||||
if (connectTimer)
|
if (connectTimer)
|
||||||
connectTimer->stop();
|
connectTimer->stop();
|
||||||
}
|
|
||||||
|
|
||||||
|
if (socketEngine) {
|
||||||
if (socketEngine->state() == QAbstractSocket::ConnectedState) {
|
if (socketEngine->state() == QAbstractSocket::ConnectedState) {
|
||||||
// Fetch the parameters if our connection is completed;
|
// Fetch the parameters if our connection is completed;
|
||||||
// otherwise, fall out and try the next address.
|
// otherwise, fall out and try the next address.
|
||||||
@ -1157,11 +1155,6 @@ void QAbstractSocketPrivate::_q_testConnection()
|
|||||||
addresses.clear();
|
addresses.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (threadData->hasEventDispatcher()) {
|
|
||||||
if (connectTimer)
|
|
||||||
connectTimer->stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(QABSTRACTSOCKET_DEBUG)
|
#if defined(QABSTRACTSOCKET_DEBUG)
|
||||||
qDebug("QAbstractSocketPrivate::_q_testConnection() connection failed,"
|
qDebug("QAbstractSocketPrivate::_q_testConnection() connection failed,"
|
||||||
" checking for alternative addresses");
|
" checking for alternative addresses");
|
||||||
@ -2370,11 +2363,6 @@ void QAbstractSocket::abort()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (d->connectTimer) {
|
|
||||||
d->connectTimer->stop();
|
|
||||||
delete d->connectTimer;
|
|
||||||
d->connectTimer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->abortCalled = true;
|
d->abortCalled = true;
|
||||||
close();
|
close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user