diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-04 11:17:47 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-04 11:17:47 (GMT) |
commit | be212bf108e71ba3b5b75802b1f4de6613ba315c (patch) | |
tree | c541ad12e8698f04e8fe386c2e1b94e8baca6c1b /src/network/socket | |
parent | 67ae1b0dac175f48875507f3187ed49276a29ddf (diff) | |
parent | e6bb00250b321b149dd80259dc4f479088d5949b (diff) | |
download | Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.zip Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.gz Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.bz2 |
Merge commit 'origin/master'
Conflicts:
src/corelib/global/qglobal.h
src/corelib/kernel/qmetatype.cpp
src/corelib/kernel/qobject.cpp
src/corelib/thread/qthread_unix.cpp
src/gui/graphicsview/qgraphicssceneevent.h
src/gui/itemviews/qheaderview.h
src/gui/kernel/qapplication_qws.cpp
src/gui/kernel/qgesture.h
src/gui/kernel/qgesturerecognizer.h
src/gui/painting/qpaintengine_raster.cpp
src/network/access/qhttpnetworkreply.cpp
src/network/access/qnetworkcookie.h
src/network/socket/qnativesocketengine_unix.cpp
Diffstat (limited to 'src/network/socket')
-rw-r--r-- | src/network/socket/qabstractsocket.h | 2 | ||||
-rw-r--r-- | src/network/socket/qabstractsocketengine_p.h | 2 | ||||
-rw-r--r-- | src/network/socket/qhttpsocketengine_p.h | 2 | ||||
-rw-r--r-- | src/network/socket/qlocalserver.h | 2 | ||||
-rw-r--r-- | src/network/socket/qlocalserver_unix.cpp | 10 | ||||
-rw-r--r-- | src/network/socket/qlocalsocket.h | 2 | ||||
-rw-r--r-- | src/network/socket/qlocalsocket_unix.cpp | 14 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine.cpp | 8 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_p.h | 6 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_unix.cpp | 43 | ||||
-rw-r--r-- | src/network/socket/qsocks5socketengine_p.h | 2 | ||||
-rw-r--r-- | src/network/socket/qtcpserver.h | 2 | ||||
-rw-r--r-- | src/network/socket/qtcpsocket.h | 2 | ||||
-rw-r--r-- | src/network/socket/qudpsocket.cpp | 16 | ||||
-rw-r--r-- | src/network/socket/qudpsocket.h | 2 |
15 files changed, 58 insertions, 57 deletions
diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h index 50a38bb..42e3ffd 100644 --- a/src/network/socket/qabstractsocket.h +++ b/src/network/socket/qabstractsocket.h @@ -209,7 +209,7 @@ protected: QAbstractSocket(SocketType socketType, QAbstractSocketPrivate &dd, QObject *parent = 0); private: - Q_DECLARE_PRIVATE(QAbstractSocket) + Q_DECLARE_SCOPED_PRIVATE(QAbstractSocket) Q_DISABLE_COPY(QAbstractSocket) Q_PRIVATE_SLOT(d_func(), void _q_connectToNextAddress()) diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h index 39c00cc..3a6aa62 100644 --- a/src/network/socket/qabstractsocketengine_p.h +++ b/src/network/socket/qabstractsocketengine_p.h @@ -177,7 +177,7 @@ protected: void setPeerPort(quint16 port); private: - Q_DECLARE_PRIVATE(QAbstractSocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QAbstractSocketEngine) Q_DISABLE_COPY(QAbstractSocketEngine) }; diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h index bc7e47a..f4d29cf 100644 --- a/src/network/socket/qhttpsocketengine_p.h +++ b/src/network/socket/qhttpsocketengine_p.h @@ -144,7 +144,7 @@ private: void emitWriteNotification(); void emitConnectionNotification(); - Q_DECLARE_PRIVATE(QHttpSocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QHttpSocketEngine) Q_DISABLE_COPY(QHttpSocketEngine) }; diff --git a/src/network/socket/qlocalserver.h b/src/network/socket/qlocalserver.h index 24b69a8..10dd62f 100644 --- a/src/network/socket/qlocalserver.h +++ b/src/network/socket/qlocalserver.h @@ -58,7 +58,7 @@ class QLocalServerPrivate; class Q_NETWORK_EXPORT QLocalServer : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QLocalServer) + Q_DECLARE_SCOPED_PRIVATE(QLocalServer) Q_SIGNALS: void newConnection(); diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index 14a0c78..aa1f7da 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -117,7 +117,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) // // As an workaround, we set the socket to non blocking so possible // 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. int flags = fcntl(listenSocket, F_GETFL, 0); @@ -125,10 +125,10 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) || -1 == (fcntl(listenSocket, F_SETFL, flags | O_NONBLOCK))) { setError(QLatin1String("QLocalServer::listen")); closeServer(); - return false; - } -#endif - + return false; + } +#endif + // bind if(-1 == QT_SOCKET_BIND(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) { setError(QLatin1String("QLocalServer::listen")); diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h index 4bff62e..6a07d74 100644 --- a/src/network/socket/qlocalsocket.h +++ b/src/network/socket/qlocalsocket.h @@ -58,7 +58,7 @@ class QLocalSocketPrivate; class Q_NETWORK_EXPORT QLocalSocket : public QIODevice { Q_OBJECT - Q_DECLARE_PRIVATE(QLocalSocket) + Q_DECLARE_SCOPED_PRIVATE(QLocalSocket) public: enum LocalSocketError diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 835b922..22873d6 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -306,7 +306,7 @@ void QLocalSocketPrivate::_q_connectToSocket() case ETIMEDOUT: errorOccurred(QLocalSocket::SocketTimeoutError, function); break; - case EINPROGRESS: + case EINPROGRESS: case EAGAIN: // Try again later, all of the sockets listening are full if (!delayConnect) { @@ -539,14 +539,14 @@ bool QLocalSocket::waitForConnected(int msec) timer.start(); while (state() == ConnectingState && (-1 == msec || timer.elapsed() < msec)) { -#ifdef Q_OS_SYMBIAN - // On Symbian, ready-to-write is signaled when non-blocking socket - // connect is finised. Is ready-to-read really used on other - // UNIX paltforms when using non-blocking AF_UNIX socket? +#ifdef Q_OS_SYMBIAN + // On Symbian, ready-to-write is signaled when non-blocking socket + // connect is finised. Is ready-to-read really used on other + // UNIX paltforms when using non-blocking AF_UNIX socket? result = ::select(d->connectingSocket + 1, 0, &fds, 0, &timeout); #else - result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout); -#endif + result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout); +#endif if (-1 == result && errno != EINTR) { d->errorOccurred( QLocalSocket::UnknownSocketError, QLatin1String("QLocalSocket::waitForConnected")); diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index 666c86e..f88094a 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -381,13 +381,13 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb return false; } - + // Make sure we receive out-of-band data // On Symbian OS this works only with native IP stack, not with WinSock if (socketType == QAbstractSocket::TcpSocket && !setOption(ReceiveOutOfBandData, 1)) { qWarning("QNativeSocketEngine::initialize unable to inline out-of-band data"); - } + } // Set the send and receive buffer sizes to a magic size, found // most optimal for our platforms. @@ -913,7 +913,7 @@ bool QNativeSocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWri d_func()->fetchConnectionParameters(); return true; } -#endif +#endif if (ret == 0) { if (timedOut) *timedOut = true; @@ -1094,7 +1094,7 @@ bool QExceptionNotifier::event(QEvent *e) engine->exceptionNotification(); return true; } - return QSocketNotifier::event(e); + return QSocketNotifier::event(e); } void QNativeSocketEngine::setReadNotificationEnabled(bool enable) diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 0a5c19d..e26e9cb 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -288,7 +288,7 @@ public Q_SLOTS: void connectionNotification(); private: - Q_DECLARE_PRIVATE(QNativeSocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QNativeSocketEngine) Q_DISABLE_COPY(QNativeSocketEngine) }; @@ -317,8 +317,8 @@ public: struct sockaddr_storage aa; #else struct sockaddr_in aa; -#endif - +#endif + QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier; #ifdef Q_OS_WIN diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 7584357..5df9769 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -337,8 +337,8 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 { #ifdef QNATIVESOCKETENGINE_DEBUG qDebug("QNativeSocketEnginePrivate::nativeConnect() : %d ", socketDescriptor); -#endif - +#endif + struct sockaddr_in sockAddrIPv4; struct sockaddr *sockAddrPtr = 0; QT_SOCKLEN_T sockAddrSize = 0; @@ -678,23 +678,23 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l #if !defined(QT_NO_IPV6) struct sockaddr_in6 sockAddrIPv6; if (host.protocol() == QAbstractSocket::IPv6Protocol) { - memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); - sockAddrIPv6.sin6_family = AF_INET6; - sockAddrIPv6.sin6_port = htons(port); - - Q_IPV6ADDR tmp = host.toIPv6Address(); - memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &tmp, sizeof(tmp)); - sockAddrSize = sizeof(sockAddrIPv6); - sockAddrPtr = (struct sockaddr *)&sockAddrIPv6; + memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); + sockAddrIPv6.sin6_family = AF_INET6; + sockAddrIPv6.sin6_port = htons(port); + + Q_IPV6ADDR tmp = host.toIPv6Address(); + memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &tmp, sizeof(tmp)); + sockAddrSize = sizeof(sockAddrIPv6); + sockAddrPtr = (struct sockaddr *)&sockAddrIPv6; } else #endif if (host.protocol() == QAbstractSocket::IPv4Protocol) { - memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4)); - sockAddrIPv4.sin_family = AF_INET; - sockAddrIPv4.sin_port = htons(port); - sockAddrIPv4.sin_addr.s_addr = htonl(host.toIPv4Address()); - sockAddrSize = sizeof(sockAddrIPv4); - sockAddrPtr = (struct sockaddr *)&sockAddrIPv4; + memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4)); + sockAddrIPv4.sin_family = AF_INET; + sockAddrIPv4.sin_port = htons(port); + sockAddrIPv4.sin_addr.s_addr = htonl(host.toIPv4Address()); + sockAddrSize = sizeof(sockAddrIPv4); + sockAddrPtr = (struct sockaddr *)&sockAddrIPv4; } // ignore the SIGPIPE signal @@ -916,15 +916,16 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co #ifndef Q_OS_SYMBIAN retval = qt_safe_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv); #else - retval = qt_safe_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv); + retval = qt_socket_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv); #endif else #ifndef Q_OS_SYMBIAN retval = qt_safe_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv); #else - retval = qt_safe_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv); + retval = qt_socket_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv); #endif + #ifdef Q_OS_SYMBIAN bool selectForExec = false; if(retval != 0) { @@ -934,16 +935,16 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co selectForExec = FD_ISSET(socketDescriptor, &fdexec); } if(selectForExec) { - qWarning("nativeSelect (selectForRead %d, retVal %d, errno %d) Unexpected expectfds ready in fd %d", + qWarning("nativeSelect (selectForRead %d, retVal %d, errno %d) Unexpected expectfds ready in fd %d", selectForRead, retval, errno, socketDescriptor); - } + } #endif return retval; } int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite, - bool *selectForRead, bool *selectForWrite) const + bool *selectForRead, bool *selectForWrite) const { fd_set fdread; FD_ZERO(&fdread); diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h index 19560f0..04c6280 100644 --- a/src/network/socket/qsocks5socketengine_p.h +++ b/src/network/socket/qsocks5socketengine_p.h @@ -117,7 +117,7 @@ public: void setExceptionNotificationEnabled(bool enable); private: - Q_DECLARE_PRIVATE(QSocks5SocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QSocks5SocketEngine) Q_DISABLE_COPY(QSocks5SocketEngine) Q_PRIVATE_SLOT(d_func(), void _q_controlSocketConnected()) Q_PRIVATE_SLOT(d_func(), void _q_controlSocketReadNotification()) diff --git a/src/network/socket/qtcpserver.h b/src/network/socket/qtcpserver.h index 19f2a45..697f998 100644 --- a/src/network/socket/qtcpserver.h +++ b/src/network/socket/qtcpserver.h @@ -99,7 +99,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QTcpServer) - Q_DECLARE_PRIVATE(QTcpServer) + Q_DECLARE_SCOPED_PRIVATE(QTcpServer) }; QT_END_NAMESPACE diff --git a/src/network/socket/qtcpsocket.h b/src/network/socket/qtcpsocket.h index 4e1003a..b0bb80f 100644 --- a/src/network/socket/qtcpsocket.h +++ b/src/network/socket/qtcpsocket.h @@ -65,7 +65,7 @@ protected: private: Q_DISABLE_COPY(QTcpSocket) - Q_DECLARE_PRIVATE(QTcpSocket) + Q_DECLARE_SCOPED_PRIVATE(QTcpSocket) }; QT_END_NAMESPACE diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp index 32f72df..71a71cb 100644 --- a/src/network/socket/qudpsocket.cpp +++ b/src/network/socket/qudpsocket.cpp @@ -94,12 +94,12 @@ This enum describes the different flags you can pass to modify the behavior of QUdpSocket::bind(). - + \note On Symbian OS bind flags behaviour depends on process capabilties. - If process has NetworkControl capability, the bind attempt with + If process has NetworkControl capability, the bind attempt with ReuseAddressHint will always succeed even the address and port is already - bound by another socket with any flags. If process does not have - NetworkControl capability, the bind attempt to address and port already + bound by another socket with any flags. If process does not have + NetworkControl capability, the bind attempt to address and port already bound by another socket will always fail. \value ShareAddress Allow other services to bind to the same address @@ -356,7 +356,7 @@ qint64 QUdpSocket::pendingDatagramSize() const as even if they are sent successfully, they are likely to be fragmented by the IP layer before arriving at their final destination. - + \warning In S60 5.0 and earlier versions, the writeDatagram return value is not reliable for large datagrams. @@ -386,8 +386,8 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre // As an workaround, we just set sent = size if( sent == 0 ) sent = size; - } -#endif + } +#endif d->cachedSocketDescriptor = d->socketEngine->socketDescriptor(); if (sent >= 0) { @@ -400,7 +400,7 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre return sent; } -/*! +/*! \fn qint64 QUdpSocket::writeDatagram(const QByteArray &datagram, const QHostAddress &host, quint16 port) \overload diff --git a/src/network/socket/qudpsocket.h b/src/network/socket/qudpsocket.h index 078b8ad..ea0c42c 100644 --- a/src/network/socket/qudpsocket.h +++ b/src/network/socket/qudpsocket.h @@ -85,7 +85,7 @@ public: private: Q_DISABLE_COPY(QUdpSocket) - Q_DECLARE_PRIVATE(QUdpSocket) + Q_DECLARE_SCOPED_PRIVATE(QUdpSocket) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QUdpSocket::BindMode) |