summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/socket')
-rw-r--r--src/network/socket/qabstractsocket.cpp30
-rw-r--r--src/network/socket/qabstractsocket.h1
-rw-r--r--src/network/socket/qabstractsocket_p.h7
-rw-r--r--src/network/socket/qlocalserver_unix.cpp2
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp4
5 files changed, 42 insertions, 2 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 66cdffb..c638e2a 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -1210,6 +1210,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.h b/src/network/socket/qabstractsocket.h
index f610db3..df09b92 100644
--- a/src/network/socket/qabstractsocket.h
+++ b/src/network/socket/qabstractsocket.h
@@ -64,6 +64,7 @@ class QAuthenticator;
class Q_NETWORK_EXPORT QAbstractSocket : public QIODevice
{
Q_OBJECT
+ Q_ENUMS(SocketType NetworkLayerProtocol SocketError SocketState SocketOption)
public:
enum SocketType {
TcpSocket,
diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h
index 6c333d3..8ca83fc 100644
--- a/src/network/socket/qabstractsocket_p.h
+++ b/src/network/socket/qabstractsocket_p.h
@@ -155,6 +155,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
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
index 560f5f6..c218d89 100644
--- a/src/network/socket/qlocalserver_unix.cpp
+++ b/src/network/socket/qlocalserver_unix.cpp
@@ -119,7 +119,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
// subsequent call to accept will not block in any case
//
// This change can be removed once more generic fix to select thread
- // syncronization problem is implemented.
+ // synchronization problem is implemented.
int flags = fcntl(listenSocket, F_GETFL, 0);
if (-1 == flags
|| -1 == (fcntl(listenSocket, F_SETFL, flags | O_NONBLOCK))) {
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index f952cee..dbf443e 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -714,6 +714,8 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &a, quint16 port)
address = QHostAddress(QHostAddress::Any);
}
break;
+ default:
+ break;
}
struct sockaddr_in sockAddrIPv4;
@@ -799,7 +801,7 @@ int QNativeSocketEnginePrivate::nativeAccept()
{
int acceptedDescriptor = WSAAccept(socketDescriptor, 0,0,0,0);
if (acceptedDescriptor != -1 && QAbstractEventDispatcher::instance()) {
- // Becuase of WSAAsyncSelect() WSAAccept returns a non blocking socket
+ // Because of WSAAsyncSelect() WSAAccept returns a non blocking socket
// with the same attributes as the listening socket including the current
// WSAAsyncSelect(). To be able to change the socket to blocking mode the
// WSAAsyncSelect() call must be cancled.