diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2010-12-06 14:02:02 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2010-12-06 14:02:02 (GMT) |
commit | 7ec11a51d564c85d46ddee270cf7c743a2cbd320 (patch) | |
tree | 0fb45af2456b659fc3f4812b2af6cca8bf051798 | |
parent | de55502a960a1044770aa840d7e443343b3c436b (diff) | |
download | Qt-7ec11a51d564c85d46ddee270cf7c743a2cbd320.zip Qt-7ec11a51d564c85d46ddee270cf7c743a2cbd320.tar.gz Qt-7ec11a51d564c85d46ddee270cf7c743a2cbd320.tar.bz2 |
Use socket manager in QtNetwork
Store/Retrieve sockets in the socket manager
Use the shared socket server instance from QtCore
Also, add 4 stub functions for multicast groups (new in master) to fix
link error
Reviewed-by: Markus Goetz
-rw-r--r-- | src/network/socket/qnativesocketengine.cpp | 17 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_p.h | 2 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_symbian.cpp | 35 |
3 files changed, 43 insertions, 11 deletions
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index df73b9c..00d36b4 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -110,6 +110,10 @@ # include "qtcpserver.h" #endif +#ifdef Q_OS_SYMBIAN +# include <private/qcore_symbian_p.h> +#endif + QT_BEGIN_NAMESPACE //#define QNATIVESOCKETENGINE_DEBUG @@ -158,12 +162,15 @@ QT_BEGIN_NAMESPACE concurrent QNativeSocketEngine. This is safe, because WSAStartup and WSACleanup are reference counted. */ -QNativeSocketEnginePrivate::QNativeSocketEnginePrivate() +QNativeSocketEnginePrivate::QNativeSocketEnginePrivate() : + socketDescriptor(-1), +#ifdef Q_OS_SYMBIAN + socketServer(qt_symbianGetSocketServer()), +#endif + readNotifier(0), + writeNotifier(0), + exceptNotifier(0) { - socketDescriptor = -1; - readNotifier = 0; - writeNotifier = 0; - exceptNotifier = 0; } /*! \internal diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index ceecfeb..c017065 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -200,7 +200,7 @@ public: int socketDescriptor; #ifdef Q_OS_SYMBIAN mutable RSocket nativeSocket; - RSocketServ socketServer; //TODO: shared ref + RSocketServ& socketServer; RConnection connection; //TODO: shared ref mutable RTimer selectTimer; #endif diff --git a/src/network/socket/qnativesocketengine_symbian.cpp b/src/network/socket/qnativesocketengine_symbian.cpp index 788e58a..d1a0819 100644 --- a/src/network/socket/qnativesocketengine_symbian.cpp +++ b/src/network/socket/qnativesocketengine_symbian.cpp @@ -46,6 +46,7 @@ #include "qhostaddress.h" #include "qelapsedtimer.h" #include "qvarlengtharray.h" +#include "qnetworkinterface.h" #include <es_sock.h> #include <in_sock.h> #include <QtCore/private/qcore_symbian_p.h> @@ -165,7 +166,7 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc return false; } - socketDescriptor = QSymbianSocketManager::instance().addSocket(&nativeSocket); + socketDescriptor = QSymbianSocketManager::instance().addSocket(nativeSocket); return true; } @@ -547,10 +548,8 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters() return false; if (!nativeSocket.SubSessionHandle()) { - RSocket *s = QSymbianSocketManager::instance().lookupSocket(socketDescriptor); - if (!s) + if (!QSymbianSocketManager::instance().lookupSocket(socketDescriptor, nativeSocket)) return false; - nativeSocket = *s; //TODO: badwrongfun (address is different, so this is broken) } // Determine local address @@ -621,7 +620,7 @@ void QNativeSocketEnginePrivate::nativeClose() //TODO: call nativeSocket.Shutdown(EImmediate) in some cases? nativeSocket.Close(); - QSymbianSocketManager::instance().removeSocket(&nativeSocket); + QSymbianSocketManager::instance().removeSocket(nativeSocket); } qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) @@ -768,4 +767,30 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c return 1; } +bool QNativeSocketEnginePrivate::nativeJoinMulticastGroup(const QHostAddress &groupAddress, + const QNetworkInterface &iface) +{ + //TODO + return false; +} + +bool QNativeSocketEnginePrivate::nativeLeaveMulticastGroup(const QHostAddress &groupAddress, + const QNetworkInterface &iface) +{ + //TODO + return false; +} + +QNetworkInterface QNativeSocketEnginePrivate::nativeMulticastInterface() const +{ + //TODO + return QNetworkInterface(); +} + +bool QNativeSocketEnginePrivate::nativeSetMulticastInterface(const QNetworkInterface &iface) +{ + //TODO + return false; +} + QT_END_NAMESPACE |