diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-10-18 14:10:15 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-10-27 12:40:26 (GMT) |
commit | b6b276495b0d02e3bcfa62b793c83f5adcf178c7 (patch) | |
tree | 6015846407e9ceedd05c8d7ddeba758fdfbe9e96 /src/network/socket/qabstractsocket.cpp | |
parent | 96beb59dc7fb303debbbf06beb192158ab3476c2 (diff) | |
download | Qt-b6b276495b0d02e3bcfa62b793c83f5adcf178c7.zip Qt-b6b276495b0d02e3bcfa62b793c83f5adcf178c7.tar.gz Qt-b6b276495b0d02e3bcfa62b793c83f5adcf178c7.tar.bz2 |
Sockets: Private function for pausing/resuming notifiers
This will be used by QNAM to prevent event loop recursion while
emitting signals that often spin an event loop, e.g.
authenticationRequired() displaying a dialog for the user.
Reviewed-by: Peter Hartmann
Reviewed-by: Prasanth
Task-Number: QTBUG-13234
Diffstat (limited to 'src/network/socket/qabstractsocket.cpp')
-rw-r--r-- | src/network/socket/qabstractsocket.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 505db71..f03d102 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1212,6 +1212,36 @@ void QAbstractSocketPrivate::fetchConnectionParameters() #endif } + +void QAbstractSocketPrivate::pauseSocketNotifiers(QAbstractSocket *socket) +{ + QAbstractSocketEngine *socketEngine = socket->d_func()->socketEngine; + if (!socketEngine) + return; + socket->d_func()->prePauseReadSocketNotifierState = socketEngine->isReadNotificationEnabled(); + socket->d_func()->prePauseWriteSocketNotifierState = socketEngine->isWriteNotificationEnabled(); + socket->d_func()->prePauseExceptionSocketNotifierState = socketEngine->isExceptionNotificationEnabled(); + socketEngine->setReadNotificationEnabled(false); + socketEngine->setWriteNotificationEnabled(false); + socketEngine->setExceptionNotificationEnabled(false); +} + +void QAbstractSocketPrivate::resumeSocketNotifiers(QAbstractSocket *socket) +{ + QAbstractSocketEngine *socketEngine = socket->d_func()->socketEngine; + if (!socketEngine) + return; + socketEngine->setReadNotificationEnabled(socket->d_func()->prePauseReadSocketNotifierState); + socketEngine->setWriteNotificationEnabled(socket->d_func()->prePauseWriteSocketNotifierState); + socketEngine->setExceptionNotificationEnabled(socket->d_func()->prePauseExceptionSocketNotifierState); +} + +QAbstractSocketEngine* QAbstractSocketPrivate::getSocketEngine(QAbstractSocket *socket) +{ + return socket->d_func()->socketEngine; +} + + /*! \internal Constructs a new abstract socket of type \a socketType. The \a |