summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qabstractsocket.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2017-09-06 16:04:51 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2017-09-20 19:18:34 +0000
commitbcd81a9e2d59bb90567fbc8dec85fc51fd5befa0 (patch)
tree454d0d3f71f23ab0ed42b196709532e7ad18bd71 /src/network/socket/qabstractsocket.cpp
parente0c2d328b11ab893538393fad66ad61d22d823c6 (diff)
QAbstractSocket: remove disconnect timer
Nowadays, there is no need for this additional timer. It was intended to forcibly disconnect the socket if an appropriate write notification has not arrived. After several fixes in the notification system this does not occur anymore, because otherwise we might have seen the hangs in the regular data transmitting. Also, it can break a delaying disconnect of the socket, if a write chunk is large enough. Task-number: QTBUG-63000 Change-Id: I9b9fd46af0209f9ce006a6d5ee5bfac9ea85482d Reviewed-by: Anthony Groyer <anthony.groyer@airliquide.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/socket/qabstractsocket.cpp')
-rw-r--r--src/network/socket/qabstractsocket.cpp26
1 files changed, 0 insertions, 26 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 7ecbf35489..92c18fb0f1 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -565,7 +565,6 @@ QAbstractSocketPrivate::QAbstractSocketPrivate()
isBuffered(false),
hasPendingData(false),
connectTimer(0),
- disconnectTimer(0),
hostLookupId(-1),
socketType(QAbstractSocket::UnknownSocketType),
state(QAbstractSocket::UnconnectedState),
@@ -604,8 +603,6 @@ void QAbstractSocketPrivate::resetSocketLayer()
}
if (connectTimer)
connectTimer->stop();
- if (disconnectTimer)
- disconnectTimer->stop();
}
/*! \internal
@@ -1222,15 +1219,6 @@ void QAbstractSocketPrivate::_q_abortConnectionAttempt()
}
}
-void QAbstractSocketPrivate::_q_forceDisconnect()
-{
- Q_Q(QAbstractSocket);
- if (socketEngine && socketEngine->isValid() && state == QAbstractSocket::ClosingState) {
- socketEngine->close();
- q->disconnectFromHost();
- }
-}
-
/*! \internal
Reads data from the socket layer into the read buffer. Returns
@@ -2753,20 +2741,6 @@ void QAbstractSocket::disconnectFromHost()
// Wait for pending data to be written.
if (d->socketEngine && d->socketEngine->isValid() && (!d->allWriteBuffersEmpty()
|| d->socketEngine->bytesToWrite() > 0)) {
- // hack: when we are waiting for the socket engine to write bytes (only
- // possible when using Socks5 or HTTP socket engine), then close
- // anyway after 2 seconds. This is to prevent a timeout on Mac, where we
- // sometimes just did not get the write notifier from the underlying
- // CFSocket and no progress was made.
- if (d->allWriteBuffersEmpty() && d->socketEngine->bytesToWrite() > 0) {
- if (!d->disconnectTimer) {
- d->disconnectTimer = new QTimer(this);
- connect(d->disconnectTimer, SIGNAL(timeout()), this,
- SLOT(_q_forceDisconnect()), Qt::DirectConnection);
- }
- if (!d->disconnectTimer->isActive())
- d->disconnectTimer->start(2000);
- }
d->socketEngine->setWriteNotificationEnabled(true);
#if defined(QABSTRACTSOCKET_DEBUG)