diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-04-12 12:18:29 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-04-12 12:18:29 (GMT) |
commit | 04d1cbce75e77392077ce4ae014fe8774c32a8fc (patch) | |
tree | d8e52dbced2f087d75e3889d7d2c0b3c19f98570 /src/network/bearer | |
parent | f62e846c7ebe243a2a36e7577d070f1275f2ec47 (diff) | |
parent | d01f82879dd4d40ece8afb54d6d25f1ef9e35624 (diff) | |
download | Qt-04d1cbce75e77392077ce4ae014fe8774c32a8fc.zip Qt-04d1cbce75e77392077ce4ae014fe8774c32a8fc.tar.gz Qt-04d1cbce75e77392077ce4ae014fe8774c32a8fc.tar.bz2 |
Merge branch 'symbian-socket-engine' of scm.dev.troll.no:qt/qt-symbian-network
Conflicts:
configure.exe
src/s60installs/bwins/QtCoreu.def
src/s60installs/bwins/QtGuiu.def
src/s60installs/eabi/QtCoreu.def
Diffstat (limited to 'src/network/bearer')
-rw-r--r-- | src/network/bearer/qnetworksession.cpp | 40 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession_p.h | 22 |
2 files changed, 61 insertions, 1 deletions
diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index af60a43..21e64d9 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -44,10 +44,16 @@ #include <QEventLoop> #include <QTimer> +#include <QThread> #include "qnetworkconfigmanager_p.h" #include "qnetworksession_p.h" +#ifdef Q_OS_SYMBIAN +#include <es_sock.h> +#include <private/qcore_symbian_p.h> +#endif + #ifndef QT_NO_BEARERMANAGEMENT QT_BEGIN_NAMESPACE @@ -705,6 +711,40 @@ void QNetworkSession::disconnectNotify(const char *signal) d->setALREnabled(false); } +#ifdef Q_OS_SYMBIAN +RConnection* QNetworkSessionPrivate::nativeSession(QNetworkSession &s) +{ + if (!s.d) + return 0; + if (s.thread() != QThread::currentThread()) + qWarning("QNetworkSessionPrivate::nativeSession called in wrong thread"); + return s.d->nativeSession(); +} + +TInt QNetworkSessionPrivate::nativeOpenSocket(QNetworkSession& s, RSocket& sock, TUint family, TUint type, TUint protocol) +{ + if (!s.d) + return 0; + QMutexLocker lock(&(s.d->mutex)); + RConnection *con = s.d->nativeSession(); + if (!con || !con->SubSessionHandle()) + return KErrNotReady; + return sock.Open(qt_symbianGetSocketServer(), family, type, protocol, *con); +} + +TInt QNetworkSessionPrivate::nativeOpenHostResolver(QNetworkSession& s, RHostResolver& resolver, TUint family, TUint protocol) +{ + if (!s.d) + return 0; + QMutexLocker lock(&(s.d->mutex)); + RConnection *con = s.d->nativeSession(); + if (!con || !con->SubSessionHandle()) + return KErrNotReady; + return resolver.Open(qt_symbianGetSocketServer(), family, protocol, *con); +} + +#endif + #include "moc_qnetworksession.cpp" QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 707ad37..a92b7ce 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -55,9 +55,16 @@ #include "qnetworksession.h" #include "qnetworkconfiguration_p.h" +#include "QtCore/qsharedpointer.h" #ifndef QT_NO_BEARERMANAGEMENT +#ifdef Q_OS_SYMBIAN +class RConnection; +class RSocket; +class RHostResolver; +#endif + QT_BEGIN_NAMESPACE class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject @@ -68,7 +75,7 @@ class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject public: QNetworkSessionPrivate() : QObject(), - state(QNetworkSession::Invalid), isOpen(false) + state(QNetworkSession::Invalid), isOpen(false), mutex(QMutex::Recursive) {} virtual ~QNetworkSessionPrivate() {} @@ -102,6 +109,15 @@ public: virtual quint64 bytesReceived() const = 0; virtual quint64 activeTime() const = 0; +#ifdef Q_OS_SYMBIAN + // get internal RConnection (not thread safe, call only from thread that owns the QNetworkSession) + static RConnection* nativeSession(QNetworkSession&); + virtual RConnection* nativeSession() = 0; + // open socket using the internal RConnection (thread safe) + static TInt nativeOpenSocket(QNetworkSession& session, RSocket& socket, TUint family, TUint type, TUint protocol); + // open host resolver using the internal RConnection (thread safe) + static TInt nativeOpenHostResolver(QNetworkSession& session, RHostResolver& resolver, TUint family, TUint protocol); +#endif protected: inline QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const { @@ -141,10 +157,14 @@ protected: QNetworkSession::State state; bool isOpen; + + QMutex mutex; }; QT_END_NAMESPACE +Q_DECLARE_METATYPE(QSharedPointer<QNetworkSession>) + #endif // QT_NO_BEARERMANAGEMENT #endif // QNETWORKSESSIONPRIVATE_H |