diff options
Diffstat (limited to 'src/network/socket')
-rw-r--r-- | src/network/socket/qabstractsocket.cpp | 30 | ||||
-rw-r--r-- | src/network/socket/qabstractsocket_p.h | 7 |
2 files changed, 37 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 diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h index b51c301..7fba0fe 100644 --- a/src/network/socket/qabstractsocket_p.h +++ b/src/network/socket/qabstractsocket_p.h @@ -158,6 +158,13 @@ public: QAbstractSocket::SocketState state; QAbstractSocket::SocketError socketError; + + bool prePauseReadSocketNotifierState; + bool prePauseWriteSocketNotifierState; + bool prePauseExceptionSocketNotifierState; + static void pauseSocketNotifiers(QAbstractSocket*); + static void resumeSocketNotifiers(QAbstractSocket*); + static QAbstractSocketEngine* getSocketEngine(QAbstractSocket*); }; QT_END_NAMESPACE |