summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-12-06 15:57:59 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-12-06 16:47:44 (GMT)
commit5ef1fb5823a25cd4b27029701f7d707c82750acb (patch)
tree4febd190edf68fbbf0c399c830b6229c3623ef6a
parent8dacbccfd89006d1571b3b6ab6e96ea13e74f455 (diff)
downloadQt-5ef1fb5823a25cd4b27029701f7d707c82750acb.zip
Qt-5ef1fb5823a25cd4b27029701f7d707c82750acb.tar.gz
Qt-5ef1fb5823a25cd4b27029701f7d707c82750acb.tar.bz2
Use shared socket server session everywhere
Converted uses of RSocketServ in QtNetwork and the symbian bearer plugin to use the shared session from QtCore instead of creating their own Reviewed-by: Markus Goetz
-rw-r--r--src/network/kernel/qnetworkinterface_symbian.cpp13
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp18
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.h2
3 files changed, 6 insertions, 27 deletions
diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp
index 7942461..751664e 100644
--- a/src/network/kernel/qnetworkinterface_symbian.cpp
+++ b/src/network/kernel/qnetworkinterface_symbian.cpp
@@ -44,6 +44,7 @@
#include "qnetworkinterface.h"
#include "qnetworkinterface_p.h"
#include "../corelib/kernel/qcore_symbian_p.h"
+#include <private/qcore_symbian_p.h>
#ifndef QT_NO_NETWORKINTERFACE
@@ -72,17 +73,10 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
TInt err(KErrNone);
QList<QNetworkInterfacePrivate *> interfaces;
- // Connect to Native socket server
- RSocketServ socketServ;
- err = socketServ.Connect();
- if (err)
- return interfaces;
-
// Open dummy socket for interface queries
RSocket socket;
- err = socket.Open(socketServ, _L("udp"));
+ err = socket.Open(qt_symbianGetSocketServer(), _L("udp"));
if (err) {
- socketServ.Close();
return interfaces;
}
@@ -90,7 +84,6 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
err = socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl);
if (err) {
socket.Close();
- socketServ.Close();
return interfaces;
}
@@ -176,7 +169,6 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
err = socket.SetOpt(KSoInetEnumRoutes, KSolInetRtCtrl);
if (err) {
socket.Close();
- socketServ.Close();
// return what we have
// up to this moment
return interfaces;
@@ -223,7 +215,6 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
}
socket.Close();
- socketServ.Close();
return interfaces;
}
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 53a5b4d..cfb55bf 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -47,6 +47,7 @@
#include <in_sock.h>
#include <stdapis/sys/socket.h>
#include <stdapis/net/if.h>
+#include <private/qcore_symbian_p.h>
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
#include <cmmanager.h>
@@ -65,7 +66,7 @@ QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine)
iDynamicUnSetdefaultif(0), ipConnectionNotifier(0),
iHandleStateNotificationsFromManager(false), iFirstSync(true), iStoppedByUser(false),
iClosedByUser(false), iError(QNetworkSession::UnknownSessionError), iALREnabled(0),
- iConnectInBackground(false), isOpening(false)
+ iConnectInBackground(false), isOpening(false), iSocketServ(qt_symbianGetSocketServer())
{
CActiveScheduler::Add(this);
@@ -109,7 +110,6 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
// Cancel possible RConnection::Start()
Cancel();
- iSocketServ.Close();
// Close global 'Open C' RConnection
// Clears also possible unsetdefaultif() flags.
@@ -363,20 +363,9 @@ void QNetworkSessionPrivateImpl::open()
iStoppedByUser = false;
iClosedByUser = false;
- TInt error = iSocketServ.Connect();
- if (error != KErrNone) {
- // Could not open RSocketServ
- newState(QNetworkSession::Invalid);
- iError = QNetworkSession::UnknownSessionError;
- emit QNetworkSessionPrivate::error(iError);
- syncStateWithInterface();
- return;
- }
-
- error = iConnection.Open(iSocketServ);
+ TInt error = iConnection.Open(iSocketServ);
if (error != KErrNone) {
// Could not open RConnection
- iSocketServ.Close();
newState(QNetworkSession::Invalid);
iError = QNetworkSession::UnknownSessionError;
emit QNetworkSessionPrivate::error(iError);
@@ -533,7 +522,6 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
}
Cancel(); // closes iConnection
- iSocketServ.Close();
// Close global 'Open C' RConnection. If OpenC supports,
// close the defaultif for good to avoid difficult timing
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index 8e3e997..1101d1e 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -162,7 +162,7 @@ private: // data
RLibrary iOpenCLibrary;
TOpenCUnSetdefaultifFunction iDynamicUnSetdefaultif;
- mutable RSocketServ iSocketServ;
+ mutable RSocketServ &iSocketServ; //not owned, shared from QtCore
mutable RConnection iConnection;
mutable RConnectionMonitor iConnectionMonitor;
ConnectionProgressNotifier* ipConnectionNotifier;