diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-07 05:42:30 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-07 07:31:02 (GMT) |
commit | e60d3622607cbf1b3583a205fc9e3e019a555b45 (patch) | |
tree | 14ff36efc834da413f20b2bf6b8963545d8ff9a6 /src/network/socket/qlocalsocket_unix.cpp | |
parent | d2b10ebfa77a78687389d08627ab0b14cf48fb21 (diff) | |
download | Qt-e60d3622607cbf1b3583a205fc9e3e019a555b45.zip Qt-e60d3622607cbf1b3583a205fc9e3e019a555b45.tar.gz Qt-e60d3622607cbf1b3583a205fc9e3e019a555b45.tar.bz2 |
QLocalSocket will disconnect 30 seconds after a successful delayed connect
When the connection is established, the socket notifier is deleted,
but not the connection timer, so the opened connection will be closed
after 30 seconds.
Task-number: none
Reviewed-by: Andreas
Reviewed-by: Thiago
Diffstat (limited to 'src/network/socket/qlocalsocket_unix.cpp')
-rw-r--r-- | src/network/socket/qlocalsocket_unix.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index a375e9b..38643f1 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -322,11 +322,8 @@ void QLocalSocketPrivate::_q_connectToSocket() } // connected! - if (delayConnect) { - delayConnect->setEnabled(false); - delete delayConnect; - delayConnect = 0; - } + cancelDelayedConnect(); + serverName = connectingName; fullServerName = connectingPathName; if (unixSocket.setSocketDescriptor(connectingSocket, @@ -373,6 +370,18 @@ void QLocalSocketPrivate::_q_abortConnectionAttempt() q->close(); } +void QLocalSocketPrivate::cancelDelayedConnect() +{ + if (delayConnect) { + delayConnect->setEnabled(false); + delete delayConnect; + delayConnect = 0; + connectTimer->stop(); + delete connectTimer; + connectTimer = 0; + } +} + quintptr QLocalSocket::socketDescriptor() const { Q_D(const QLocalSocket); @@ -419,14 +428,7 @@ void QLocalSocket::close() { Q_D(QLocalSocket); d->unixSocket.close(); - if (d->delayConnect) { - d->delayConnect->setEnabled(false); - delete d->delayConnect; - d->delayConnect = 0; - d->connectTimer->stop(); - delete d->connectTimer; - d->connectTimer = 0; - } + d->cancelDelayedConnect(); if (d->connectingSocket != -1) ::close(d->connectingSocket); d->connectingSocket = -1; |