summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-04-07 05:42:30 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-04-07 07:31:02 (GMT)
commite60d3622607cbf1b3583a205fc9e3e019a555b45 (patch)
tree14ff36efc834da413f20b2bf6b8963545d8ff9a6
parentd2b10ebfa77a78687389d08627ab0b14cf48fb21 (diff)
downloadQt-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
-rw-r--r--src/network/socket/qlocalsocket_p.h1
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp28
2 files changed, 16 insertions, 13 deletions
diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h
index dd48d0a..781d3da 100644
--- a/src/network/socket/qlocalsocket_p.h
+++ b/src/network/socket/qlocalsocket_p.h
@@ -192,6 +192,7 @@ public:
void _q_error(QAbstractSocket::SocketError newError);
void _q_connectToSocket();
void _q_abortConnectionAttempt();
+ void cancelDelayedConnect();
QSocketNotifier *delayConnect;
QTimer *connectTimer;
int connectingSocket;
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;