diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-03-15 18:47:11 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-03-15 20:06:21 (GMT) |
commit | 59c7740c9d45a88713db20efbfcfbdaf3873b60c (patch) | |
tree | 94dd09982e3818ff3ec58fb345f9cacb0e3dec04 /src/network/socket/qsymbiansocketengine.cpp | |
parent | 86b1e68285a4dae855a5826f76728cee347d1af2 (diff) | |
download | Qt-59c7740c9d45a88713db20efbfcfbdaf3873b60c.zip Qt-59c7740c9d45a88713db20efbfcfbdaf3873b60c.tar.gz Qt-59c7740c9d45a88713db20efbfcfbdaf3873b60c.tar.bz2 |
Make creating sockets with an explicit network session thread safe
Added a mutex to QNetworkSessionPrivate
Lock the mutex in the symbian bearer plugin for functions that change
the validity of the RConnection.
Added factory functions to open an RSocket or RHostResolver, which lock
the mutex before the esock function calls. If there is no RConnection,
then KErrNotReady is returned (the same as when there is an RConnection
but it has not been started).
Task-number: QTBUG-18143
Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network/socket/qsymbiansocketengine.cpp')
-rw-r--r-- | src/network/socket/qsymbiansocketengine.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/network/socket/qsymbiansocketengine.cpp b/src/network/socket/qsymbiansocketengine.cpp index be04b56..688f724 100644 --- a/src/network/socket/qsymbiansocketengine.cpp +++ b/src/network/socket/qsymbiansocketengine.cpp @@ -189,21 +189,13 @@ bool QSymbianSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType so //Check if there is a user specified session RConnection *connection = 0; QVariant v(q->property("_q_networksession")); + TInt err; if (v.isValid()) { QSharedPointer<QNetworkSession> s = qvariant_cast<QSharedPointer<QNetworkSession> >(v); - connection = QNetworkSessionPrivate::nativeSession(*s); + err = QNetworkSessionPrivate::nativeOpenSocket(*s, nativeSocket, family, type, protocol); #ifdef QNATIVESOCKETENGINE_DEBUG - qDebug() << "QSymbianSocketEnginePrivate::createNewSocket - _q_networksession was set" << connection; + qDebug() << "QSymbianSocketEnginePrivate::createNewSocket - _q_networksession was set" << err; #endif - } - TInt err; - if (connection) { - if (connection->SubSessionHandle()) - err = nativeSocket.Open(socketServer, family, type, protocol, *connection); - else { - setError(QAbstractSocket::NetworkError, SessionNotOpenErrorString); - return false; - } } else err = nativeSocket.Open(socketServer, family, type, protocol); //TODO: FIXME - deprecated API, make sure we always have a connection instead |