# HG changeset patch # User William Roberts # Date 1268572458 0 # Node ID e8bbc934663ad78765a6cbd401ba29bd6ce1cd52 # Parent 09352266b4c62ebcd49a328ffbea3ce6cef85a83# Parent 77effd21b2c980613a13f0d0a98e1845ab6026e4 Automatic merge from PDK_3.0.h diff -r 09352266b4c6 -r e8bbc934663a commsfwsupport/commselements/commsfw/inc/cfextras.h --- a/commsfwsupport/commselements/commsfw/inc/cfextras.h Mon Mar 08 21:44:35 2010 +0000 +++ b/commsfwsupport/commselements/commsfw/inc/cfextras.h Sun Mar 14 13:14:18 2010 +0000 @@ -23,7 +23,6 @@ #include #include -#include #include "elements/cftransportmacro.h" // This namespace is split between this file and cfutil.h. You can include this file to use COwnEntryList diff -r 09352266b4c6 -r e8bbc934663a commsfwsupport/commselements/serverden/src/sd_player.cpp --- a/commsfwsupport/commselements/serverden/src/sd_player.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/commsfwsupport/commselements/serverden/src/sd_player.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -58,7 +58,7 @@ void CCommonSessionProxy::BeginSessionClose() { - //COMMONLOG((WorkerId(),KECommonBootingTag, _L8("CSockSessionProxy %08x:\tBeginSessionClose(), iSockSession %08x"), this, iSession) ); + COMMONLOG((Player().WorkerId(),KECommonBootingTag, _L8("CCommonSessionProxy %08x:\tBeginSessionClose(), iSockSession %08x"), this, iSession) ); /* Only do something if the message is within the deadline and we're sure the session pointer is safe to use */ CCommonWorkerThread& worker = iPlayer.WorkerThread(); @@ -87,7 +87,7 @@ EXPORT_C void CCommonSessionProxy::NotifySubSessionDestroyed() { - //COMMONLOG((WorkerId(),KECommonBootingTag, _L8("CSockSessionProxy %08x:\tNotifySubSessionDestroyed(), iSockSession %08x"), this, iSession) ); + //COMMONLOG((Player().WorkerId(),KECommonBootingTag, _L8("CCommonSessionProxy %08x:\tNotifySubSessionDestroyed(), iSockSession %08x"), this, iSession) ); if(IsClosing() && --iNumSubSessClosing <= 0) { __ASSERT_DEBUG(iNumSubSessClosing == 0, User::Panic(KSpecAssert_ElemSvrDenPlayrC, 2)); @@ -202,13 +202,22 @@ return EFalse; } } - return ETrue; + + if (!iSessionProxies.IsEmpty()) + { + COMMONLOG((WorkerId(), KECommonBootingTag, _L8("-- can't; session proxies still present"))); + return EFalse; + } + + + return ETrue; } EXPORT_C void CCommonPlayer::MaybeSetPlayerShutdownComplete(TBool aForceShutdownNow) { //A forced shutdown trumps all other considerations - TBool shutdownComplete = aForceShutdownNow || (SubSessions().Count() == 0 && IsPlayerShutdownComplete()); + TBool shutdownComplete = aForceShutdownNow + || (SubSessions().Count() == 0 && iSessionProxies.IsEmpty() && IsPlayerShutdownComplete()); COMMONLOG((WorkerId(), KECommonBootingTag, _L8("CPlayer::MaybeSetPlayerShutdownComplete(), shutdownComplete = %d [forced=%d, #subSess=%d]"), shutdownComplete, aForceShutdownNow, SubSessions().Count())); diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/core_states/ss_coreprstates.cpp --- a/datacommsserver/esockserver/core_states/ss_coreprstates.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/core_states/ss_coreprstates.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -55,7 +55,6 @@ #include #include - #ifdef _DEBUG // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module // (if it could happen through user error then you should give it an explicit, documented, category + code) @@ -521,6 +520,7 @@ __ASSERT_DEBUG(iContext.iPeer, User::Panic(KSpecAssert_ESockCrStaCPRSC, 13)); __ASSERT_DEBUG(iContext.iPeer->Type()==TCFClientType::EData, User::Panic(KSpecAssert_ESockCrStaCPRSC, 14)); + __CFLOG_VAR((KCoreProviderStatesTag, KCoreProviderStatesSubTag, _L8("TSendDestroyToSendingDataClient::DoL - iContext.iPeer->Flags(): %x"), iContext.iPeer->Flags())); if (!(iContext.iPeer->Flags() & (TCFClientType::EActivating|TCFClientType::EStarting|TCFClientType::ELeaving|TCFClientType::EStarted))) { @@ -625,12 +625,24 @@ EXPORT_C void TStopDataClients::DoL() { __ASSERT_DEBUG(iContext.iNodeActivity, CorePrPanic(KPanicNoActivity)); - TInt stopCode = ExtractErrorCode(iContext.iMessage); + TInt aStopCode = ExtractErrorCode(iContext.iMessage); + // Stop all non-default data clients before the default data client, as there are some cases where non-default data clients + // have a reference to the default data client. Also, stop non-default data clients unconditionally (i.e. whether started or + // not) and the default data client only if started. This ensures that a non-default data client that is still starting + // will receive the stop, so preventing a hang. + // + // NOTE: the logic in this method is coupled to the logic in TNoTagOrDataClientsToStop. + iContext.Node().PostToClients(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()),TCFDataClient::TStop(aStopCode).CRef(), TClientType(TCFClientType::EData), TClientType(0, TClientType::ELeaving|TCFClientType::EDefault), TCFClientType::EStopping); + iContext.Node().PostToClients(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()),TCFDataClient::TStop(aStopCode).CRef(), TClientType(TCFClientType::EData, TCFClientType::EStarted|TCFClientType::EDefault), TClientType(0, TClientType::ELeaving), TCFClientType::EStopping); + iContext.iNodeActivity->ClearPostedTo(); + } - iContext.Node().PostToClients(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), - TCFDataClient::TStop(stopCode).CRef(), TClientType(TCFClientType::EData, TCFClientType::EStarted)); - iContext.iNodeActivity->ClearPostedTo(); - } +void TStopDataClients::StopDataClient(RNodeInterface& aDataClient, TInt aStopCode) + { + aDataClient.SetFlags(TCFClientType::EStopping); + aDataClient.PostMessage(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), TCFDataClient::TStop(aStopCode).CRef()); + } + EXPORT_DEFINE_SMELEMENT(TStopSelf, NetStateMachine::MStateTransition, PRStates::TContext) EXPORT_C void TStopSelf::DoL() @@ -653,7 +665,7 @@ } if (iContext.iPeer) { - iContext.iPeer->ClearFlags(TCFClientType::EStarted); + iContext.iPeer->ClearFlags(TCFClientType::EStarted | TCFClientType::EStopping); } if (iContext.iNodeActivity && (iContext.iNodeActivity->ActivitySigId() == ECFActivityStop || @@ -675,9 +687,9 @@ } if (iContext.iPeer) { - iContext.iPeer->ClearFlags(TCFClientType::EStarted); + iContext.iPeer->ClearFlags(TCFClientType::EStopping); } - if (iContext.Node().CountClients(TClientType(TCFClientType::EData, TCFClientType::EStarted))) + if (iContext.Node().CountClients(TClientType(TCFClientType::EData, TCFClientType::EStopping))) { //There are more to wait for iContext.iMessage.ClearMessageId(); @@ -1768,12 +1780,14 @@ EXPORT_DEFINE_SMELEMENT(TNoTagOrDataClientsToStop, NetStateMachine::MStateFork, CoreNetStates::TContext) EXPORT_C TInt TNoTagOrDataClientsToStop::TransitionTag() { - if (iContext.Node().GetFirstClient(TClientType(TCFClientType::EData, TCFClientType::EStarted), - TClientType(0, TClientType::ELeaving))) - { - return CoreNetStates::KDataClientsToStop | NetStateMachine::EForward; - } - return KNoTag; + // Check if there are any non-default data clients, or the default data client is started. + // NOTE: the logic in this method is coupled to the logic in TStopDataClients - see that method for further explanation. + if ((iContext.Node().CountClients(TClientType(TCFClientType::EData, TCFClientType::EDefault | TCFClientType::EStarted), TClientType(0, TClientType::ELeaving))) + || (iContext.Node().CountClients(TClientType(TCFClientType::EData), TClientType(0, TCFClientType::EDefault | TClientType::ELeaving)))) + { + return CoreNetStates::KDataClientsToStop; + } + return KNoTag; } EXPORT_DEFINE_SMELEMENT(TNoTagOrNoDataClientsToStop, NetStateMachine::MStateFork, CoreNetStates::TContext) diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/core_states/ss_coreprstates.h --- a/datacommsserver/esockserver/core_states/ss_coreprstates.h Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/core_states/ss_coreprstates.h Sun Mar 14 13:14:18 2010 +0000 @@ -67,7 +67,8 @@ KPanicPeerMisbehaving = 20, KPanicActivity = 21, - KPanicNoContext = 22 + KPanicNoContext = 22, + KPanicMultipleDefaultDataClients = 23 }; } @@ -706,6 +707,7 @@ EXPORT_DECLARE_SMELEMENT_HEADER( TStopDataClients, MeshMachine::TStateTransition, NetStateMachine::MStateTransition, TContext ) IMPORT_C virtual void DoL(); + void StopDataClient(Messages::RNodeInterface& aDataClient, TInt aStopCode); DECLARE_SMELEMENT_FOOTER( TStopDataClients ) EXPORT_DECLARE_SMELEMENT_HEADER( TStopSelf, MeshMachine::TStateTransition, NetStateMachine::MStateTransition, TContext ) diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/inc/ES_SOCK.H --- a/datacommsserver/esockserver/inc/ES_SOCK.H Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/inc/ES_SOCK.H Sun Mar 14 13:14:18 2010 +0000 @@ -657,6 +657,8 @@ */ const TInt KErrProtocolNotReady = -17214; +// -17215 used for non published error. Do not use here. + /** Used in RSocket read and write calls to pass the length of data read and written. @publishedAll diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/inc/es_sap.h --- a/datacommsserver/esockserver/inc/es_sap.h Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/inc/es_sap.h Sun Mar 14 13:14:18 2010 +0000 @@ -50,6 +50,7 @@ @released Since 9.0 */ { friend class ProtocolManager; + public: IMPORT_C virtual ~CNetworkFlow(); @@ -78,21 +79,21 @@ void ProcessDCIdleState(); -#ifdef SYMBIAN_NETWORKING_UPS - virtual TBool ActivityRunning() = 0; -#else - inline TBool NoBearerGuard() - { return iNoBearerRunning; } - inline void SetNoBearerGuard() - { iNoBearerRunning = ETrue; } - inline void ClearNoBearerGuard() - { iNoBearerRunning = EFalse; } -#endif - + protected: IMPORT_C CNetworkFlow(CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConn, CProtocolIntfBase* aProtocolIntf); void UpdateDestinationAddress(const TSockAddr& aDest); + #define SAP_FLAG_FUNCTIONS(name, flag) \ + inline TBool name() { return iStateFlags & flag; } \ + inline void Set##name() { iStateFlags |= flag; } \ + inline void Clear##name() { iStateFlags &= ~flag; } + +#ifdef SYMBIAN_NETWORKING_UPS + virtual TBool ActivityRunning() = 0; +#endif + + protected: TSockAddr iLocalAddress; TSockAddr iRemoteAddress; @@ -104,22 +105,23 @@ MFlowBinderControl* iLowerFlow; MLowerControl* iLowerControl; //just to keep the lower flow up - enum TDCIdleState + enum TStateFlag { - EClientsPresent = 0, // presumption is we're always created for a client (ie HR or socket) - EIdle = 1, - EIdleSent = 2 + ELocalAddressSet = 0x00000001, + ERemoteAddressSet = 0x00000002, + ENoBearerRunning = 0x00000004, + EStarted = 0x00000008, + EIdle = 0x00000080, + EIdleSent = 0x00000100 }; - TBool iLocalAddressSet:1; - TBool iRemoteAddressSet:1; - TBool iConnectionInfoSet:1; - TBool iJoinOutstanding:1; - TBool iLeaveOutstanding:1; -#ifndef SYMBIAN_NETWORKING_UPS - TBool iNoBearerRunning:1; // NoBearer msg has been issued to SCPR -#endif - TBool iIsStarted:1; - TDCIdleState iDCIdle:2; + SAP_FLAG_FUNCTIONS(LocalAddressSet, ELocalAddressSet) + SAP_FLAG_FUNCTIONS(RemoteAddressSet, ERemoteAddressSet) + SAP_FLAG_FUNCTIONS(NoBearerGuard, ENoBearerRunning) + SAP_FLAG_FUNCTIONS(Started, EStarted) + SAP_FLAG_FUNCTIONS(Idle, EIdle) + SAP_FLAG_FUNCTIONS(IdleSent, EIdleSent) + + TUint iStateFlags; }; } //namespace ESock diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/inc/es_sock_partner.h --- a/datacommsserver/esockserver/inc/es_sock_partner.h Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/inc/es_sock_partner.h Sun Mar 14 13:14:18 2010 +0000 @@ -89,7 +89,11 @@ */ const TUint KCoDisableCloneOpen = 6 | (KConnReadUserDataBit); - +/** +Error code to force a KErrDisconnected from a layer in the stack if sent from an mcpr. +@publishedPartner +*/ +const TInt KErrForceDisconnected = -17215; class RParameterFamilyBundle; class CSubConParameterBundle : public CObject diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/inc/ss_nodeinterfaces.h --- a/datacommsserver/esockserver/inc/ss_nodeinterfaces.h Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/inc/ss_nodeinterfaces.h Sun Mar 14 13:14:18 2010 +0000 @@ -93,8 +93,8 @@ EActive = 0x00000400,//Given away handle to this client and got a response, i.e.: assuming somebody bound to the client until //the client reports idle. (cleared by TDataClientIdle). EStarting = 0x00000800,// - EStarted = 0x00001000,//The client has sent TStarted (cleared by TStopped). - + EStarted = 0x00001000,//The client has sent TStarted . + EStopping = 0x00002000,//Stop Data Cients (cleared by TStopped) /** Internal, not to be used by partners diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/inc/ss_sapshim.h --- a/datacommsserver/esockserver/inc/ss_sapshim.h Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/inc/ss_sapshim.h Sun Mar 14 13:14:18 2010 +0000 @@ -65,6 +65,7 @@ #ifdef SYMBIAN_NETWORKING_UPS friend class CHostResolver; // to allow CHostResolver to call SecurityCheck() #endif + public: typedef CTransportFlowShimFactory FactoryType; //for factoryobject_cast to work @@ -165,9 +166,7 @@ inline TBool IsHostResolver() const; inline TBool IsStopped(); inline void SetIfInfo(const TSoIfConnectionInfo& aInfo); - inline void ClearUseBearerErrors(); - inline void ClearDataClientRoutedGuard(); - + void PostNoBearer(); void PostDataClientRouted(); // From MSocketNotify @@ -203,19 +202,33 @@ // Needs to be protected rather than private for UPS support void PostNoBearer(); void PostDataClientRouted(); - inline void ClearDataClientRoutedGuard(); #endif void CompleteStart(TInt aError); -#ifdef SYMBIAN_NETWORKING_UPS - // Not entirely UPS specific - cleanup of CNetworkFlow/CTransportFlowShim functionality split - inline TBool NoBearerGuard() const; - inline void SetNoBearerGuard(); - inline void ClearNoBearerGuard(); -#endif void NoBearerCompletion(); inline void SetFlowParams(const TFlowParams& aFlowParams); - inline TBool FlowParamsInitialised() const; + +protected: + // Flags to set on iStateFlags inherited from CNetworkFlow + enum TStateFlag + { + EDetaching = 0x0001000, + EDataClientRoutedGuard = 0x00020000, + EStopped = 0x00040000, + EShuttingDown = 0x00080000, + EFlowParamsInitialised = 0x00100000, + EBearerExpected = 0x00200000, + EDeleteUponBearerReception = 0x00400000, + EUseBearerErrors = 0x00800000 + }; + SAP_FLAG_FUNCTIONS(Detaching, EDetaching) + SAP_FLAG_FUNCTIONS(DataClientRoutedGuard, EDataClientRoutedGuard) + SAP_FLAG_FUNCTIONS(Stopped, EStopped) + SAP_FLAG_FUNCTIONS(ShuttingDown, EShuttingDown) + SAP_FLAG_FUNCTIONS(FlowParamsInitialised, EFlowParamsInitialised) + SAP_FLAG_FUNCTIONS(BearerExpected, EBearerExpected) + SAP_FLAG_FUNCTIONS(DeleteUponBearerReception, EDeleteUponBearerReception) + SAP_FLAG_FUNCTIONS(UseBearerErrors, EUseBearerErrors) private: CServProviderBase* iProvider; @@ -227,15 +240,8 @@ Messages::RRequestOriginator iStartRequest; TSoIfConnectionInfo iIfInfo; - TUint iDetaching:1; - TUint iUseBearerErrors:1; // error the socket on Error() upcalls from bearer rather than StopFlow() calls from SCPR - TUint iDataClientRoutedGuard:1; // DataClientRouted msg has been issued to SCPR - TUint iIsStopped:1; // DataClientStop has been received. -#ifdef SYMBIAN_NETWORKING_UPS - TBool iNoBearerRunning:1; // NoBearer message has been issued to SCPR - TBool iShuttingDown:1; -#endif - TBool iFlowParamsInitialised:1; // whether iFlowParams has been initialised or not + + #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW const CSAPSetOpt *iProtocolOptions; #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW @@ -243,8 +249,6 @@ // Reference to the protocol as managed by the ProtocolManager CProtocolRef* iProtocolReference; TFlowParams iFlowParams; - TBool iBearerExpected; - TBool iDeleteUponBearerReception; }; inline CServProviderBase* CTransportFlowShim::Provider() @@ -255,12 +259,7 @@ inline void CTransportFlowShim::SetFlowParams(const TFlowParams& aFlowParams) { iFlowParams = aFlowParams; - iFlowParamsInitialised = ETrue; - } - -inline TBool CTransportFlowShim::FlowParamsInitialised() const - { - return iFlowParamsInitialised; + SetFlowParamsInitialised(); } #ifdef SYMBIAN_NETWORKING_UPS @@ -268,22 +267,6 @@ // // CTransportFlowShim inline methods // - -inline TBool CTransportFlowShim::NoBearerGuard() const - { return iNoBearerRunning; } - -inline void CTransportFlowShim::SetNoBearerGuard() - { iNoBearerRunning = ETrue; } - -inline void CTransportFlowShim::ClearNoBearerGuard() - { iNoBearerRunning = EFalse; } - -inline void CTransportFlowShim::ClearUseBearerErrors() - { iUseBearerErrors = EFalse; } - -inline TBool CTransportFlowShim::IsStopped() - { return iIsStopped; } - inline TBool CTransportFlowShim::IsHostResolver() const { return iHostResolverNotify != NULL; } diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/ssock/SS_SES.CPP --- a/datacommsserver/esockserver/ssock/SS_SES.CPP Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/ssock/SS_SES.CPP Sun Mar 14 13:14:18 2010 +0000 @@ -334,6 +334,7 @@ case ESoRecvFromNoLength: case ESoRecvNoLength: case ESoRecvOneOrMore: + case ESoRecvOneOrMoreNoLength: case ESoRecvFrom: case ESoRecv: case ESoRead: diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/ssock/ss_conn.cpp --- a/datacommsserver/esockserver/ssock/ss_conn.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/ssock/ss_conn.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -523,28 +523,6 @@ iLastProgressError = aExistingConnection.iLastProgressError; iProgressQueue = aExistingConnection.iProgressQueue; - /** - The first commented in section of code here is incorrect. It only clones one of the service providers and not them - all. This means that certain calls, GetIntSetting being one, does not work on cloned connections. Unfortunately, - some code now relies on this being broken (browser). This code needs to be fixed before the first section of code - is removed and the proper code reinstated. - */ -#if 1 // BAD CODE - RNodeInterface* sp = aExistingConnection.ServiceProvider(); - if (sp) - { - AddClientL(sp->RecipientId(), TClientType(TCFClientType::EServProvider, TCFClientType::EActive)); - - // TODO IK: This is the wrong message to be using here, should use JoinRequest/Complete handshake - sp->PostMessage(Id(), TCFFactory::TPeerFoundOrCreated(Id(), 0).CRef()); - } - else - { - LOG( ESockLog::Printf(KESockConnectionTag, _L8("CConnection %08x CloneL KErrNotReady"), this) ); - User::Leave(KErrNotReady); - } - -#else // PROPER CODE /* This function looks like it'd be better to do in one loop. dont do this though. All fallible parts need to be done before sending the messages to ourselves, otherwise the mesh machine will panic. @@ -595,7 +573,6 @@ sp = iter++; } } -#endif } diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/ssock/ss_connstates.cpp --- a/datacommsserver/esockserver/ssock/ss_connstates.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/ssock/ss_connstates.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -670,6 +670,10 @@ { progress.iStage = KConnectionUp; // KLinkLayerOpen } + if (progress.iError == KErrForceDisconnected) + { + progress.iError = KErrDisconnected; + } LOG( ESockLog::Printf(KESockConnectionTag, _L("CConnection %08x:\tProgressNotification(TInt aStage %d, TInt aError %d)"), &(iContext.Node()), progress.iStage, progress.iError) ); diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/ssock/ss_log.cpp --- a/datacommsserver/esockserver/ssock/ss_log.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/ssock/ss_log.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -200,6 +200,7 @@ case ESoRecv: return _S8("ESoRecv"); case ESoRecvNoLength: return _S8("ESoRecvNoLength"); case ESoRecvOneOrMore: return _S8("ESoRecvOneOrMore"); + case ESoRecvOneOrMoreNoLength: return _S8("ESoRecvOneOrMoreNoLength"); case ESoRead: return _S8("ESoRead"); case ESoWrite: return _S8("ESoWrite"); case ESoSendTo: return _S8("ESoSendTo"); diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/ssock/ss_sap.cpp --- a/datacommsserver/esockserver/ssock/ss_sap.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/ssock/ss_sap.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -63,7 +63,7 @@ @return Returns KErrNone if the local name is correctly set or, if this is not the case, an informative error number. */ { - iLocalAddressSet = ETrue; + SetLocalAddressSet(); iLocalAddress = anAddr; } @@ -76,7 +76,7 @@ @return Returns KErrNone if the remote name is correctly set or, if this is not the case, an informative error number. */ { - iRemoteAddressSet = ETrue; + SetRemoteAddressSet(); iRemoteAddress = anAddr; return KErrNone; } @@ -84,7 +84,7 @@ void CNetworkFlow::UpdateDestinationAddress(const TSockAddr& aDest) { iRemoteAddress = aDest; - iRemoteAddressSet = ETrue; + SetRemoteAddressSet(); } TUint CNetworkFlow::Write(const TDesC8& /*aDesc*/, TUint /*aOptions*/, TSockAddr* anAddr) @@ -223,9 +223,9 @@ iSessionDataNotify = NULL; if(iSubConnectionProvider.IsOpen()) { - if(iDCIdle < EIdle) + if (!Idle()) { - iDCIdle = EIdle; + SetIdle(); ProcessDCIdleState(); } } @@ -250,12 +250,12 @@ void CNetworkFlow::ProcessDCIdleState() { #ifdef SYMBIAN_NETWORKING_UPS - if(iDCIdle == EIdle && !ActivityRunning()) + if (Idle() && !IdleSent() && !ActivityRunning()) #else - if(iDCIdle == EIdle && !iNoBearerRunning) + if (Idle() && !IdleSent() && !NoBearerGuard()) #endif { - iDCIdle = EIdleSent; + SetIdleSent(); iSubConnectionProvider.PostMessage(Id(), TCFControlProvider::TIdle().CRef()); } } diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/ssock/ss_sapshim.cpp --- a/datacommsserver/esockserver/ssock/ss_sapshim.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/ssock/ss_sapshim.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -92,8 +92,9 @@ { (void)aControl; __ASSERT_DEBUG(aControl == iHostResolverNotify, User::Panic(KSpecAssert_ESockSSocksspshm, 1)); - __ASSERT_DEBUG(iDCIdle <= EClientsPresent, User::Panic(KSpecAssert_ESockSSocksspshm, 2)); - iDCIdle = EIdle; + __ASSERT_DEBUG(!(Idle() || IdleSent()), User::Panic(KSpecAssert_ESockSSocksspshm, 2)); + SetIdle(); + iHostResolverNotify = NULL; if(iSubConnectionProvider.IsOpen()) // legacy flows have no control side { @@ -163,7 +164,7 @@ iListenerControlNotify->DisconnectFromListener(*this); } - if(!iDetaching) + if(!Detaching()) { delete iProvider; iProvider = NULL; @@ -283,14 +284,14 @@ { __ASSERT_DEBUG(!iProvider, User::Panic(KSpecAssert_ESockSSocksspshm, 9)); // can't have both HR & SAP - LOG( ESockLog::Printf(_L8("CTransportFlowShim %08x:\tUnbind(): iBearerExpected %d"), this, iBearerExpected) ); - if (!iBearerExpected) + LOG( ESockLog::Printf(_L8("CTransportFlowShim %08x:\tUnbind(): iBearerExpected %d"), this, BearerExpected()) ); + if (!BearerExpected()) { delete this; } else { - iDeleteUponBearerReception = ETrue; + SetDeleteUponBearerReception(); iHostResolverNotify = NULL; } return; @@ -300,7 +301,7 @@ { iProvider->SetNotify(NULL); - if (!iDetaching) + if (!Detaching()) { delete iProvider; iProvider = NULL; @@ -412,7 +413,7 @@ */ { TInt ret = EFalse; - if(!iIsStopped) + if(!Stopped()) { // Prevent sending NoBearer if DataClientStop was received if (LockToConnectionInfo() != KErrNone) { @@ -420,7 +421,8 @@ PostNoBearer(); ret = ETrue; } - iUseBearerErrors = EFalse; + ClearUseBearerErrors(); + ClearDataClientRoutedGuard(); } return ret; @@ -632,7 +634,7 @@ __ASSERT_DEBUG(iProvider, User::Panic(KSpecAssert_ESockSSocksspshm, 24)); if (aOption == MSessionControl::EImmediate) { - iShuttingDown = ETrue; + SetShuttingDown(); } // It is possible for the provider to be null if an error occurs immediatly @@ -880,7 +882,8 @@ if(iSessionControlNotify) { - iDetaching = aDelete == MSocketNotify::EDetach; + aDelete == MSocketNotify::EDetach ? SetDetaching() : ClearDetaching(); + iSessionControlNotify->CanClose(MSessionControlNotify::TDelete(aDelete)); if(aDelete==MSocketNotify::EDetach) { @@ -903,7 +906,7 @@ if(iSessionControlNotify) { - iDetaching = aDelete == MSocketNotify::EDetach; + aDelete == MSocketNotify::EDetach ? SetDetaching() : ClearDetaching(); iSessionControlNotify->CanClose(aDisconnectData, MSessionControlNotify::TDelete(aDelete)); if(aDelete==MSocketNotify::EDetach) { @@ -945,7 +948,7 @@ // No control above us - likely cause is that we're the result of a passive open that // hasn't yet been accepted. - iDetaching = MSocketNotify::EDetach; + SetDetaching(); Unbind(); } } @@ -964,7 +967,7 @@ // No control above us - likely cause is that we're the result of a passive open that // hasn't yet been accepted. - iDetaching = MSocketNotify::EDetach; + SetDetaching(); Unbind(); } } @@ -983,7 +986,7 @@ // No control above us - likely cause is that we're the result of a passive open that // hasn't yet been accepted. - iDetaching = MSocketNotify::EDetach; + SetDetaching(); Unbind(); } } @@ -1027,11 +1030,11 @@ return; } - iUseBearerErrors = ETrue; + SetUseBearerErrors(); LocalName(iLocalAddress); - iLocalAddressSet = ETrue; + SetLocalAddressSet(); RemName(iRemoteAddress); - iRemoteAddressSet = ETrue; + SetRemoteAddressSet(); __ASSERT_DEBUG(iSubConnectionProvider.IsOpen(), User::Panic(KSpecAssert_ESockSSocksspshm, 41)); // legacy flows have no control side; should never get here PostDataClientRouted(); @@ -1170,7 +1173,7 @@ { CompleteStart(err); } - iBearerExpected = ETrue; + SetBearerExpected(); } else { @@ -1249,7 +1252,7 @@ { CompleteStart(KErrNone); } - LOG( ESockLog::Printf(_L8("CTransportFlowShim %08x:\tReceivedL(): TBearer: iDeleteUponBearerReception %d"), this, iDeleteUponBearerReception) ); + LOG( ESockLog::Printf(_L8("CTransportFlowShim %08x:\tReceivedL(): TBearer: iDeleteUponBearerReception %d"), this, DeleteUponBearerReception())); ClearNoBearerGuard(); ProcessDCIdleState(); @@ -1266,8 +1269,9 @@ void CTransportFlowShim::NoBearerCompletion() { - iBearerExpected = EFalse; - if (iDeleteUponBearerReception) + ClearBearerExpected(); + + if (DeleteUponBearerReception()) { delete this; } @@ -1283,8 +1287,8 @@ if (aError==KErrNone) { iStartRequest.ReplyTo(Id(), TCFDataClient::TStarted().CRef()); - iIsStarted = ETrue; - iIsStopped = EFalse; + SetStarted(); + ClearStopped(); } else { @@ -1333,7 +1337,7 @@ NM_LOG((KESockServerTag, _L8("CTransportFlowShim %08x:\tSynchronous call: From=%08x To=%08x Func=BindToL"), this, static_cast(this), &aBindTo.iNodeId.Node()) ) - if (iShuttingDown) + if (ShuttingDown()) { User::Leave(KErrCancel); return; @@ -1344,9 +1348,10 @@ { LockToConnectionInfo(); LocalName(iLocalAddress); - iLocalAddressSet = ETrue; + SetLocalAddressSet(); RemName(iRemoteAddress); - iRemoteAddressSet = ETrue; + SetRemoteAddressSet(); + __ASSERT_DEBUG(iSubConnectionProvider.IsOpen(), User::Panic(KSpecAssert_ESockSSocksspshm, 48)); // legacy flows have no control side; should never get here } else if (iHostResolverNotify) @@ -1382,13 +1387,13 @@ void CTransportFlowShim::StartFlowL(const TRuntimeCtxId& aSender) { - __ASSERT_DEBUG(!iIsStarted, User::Panic(KSpecAssert_ESockSSocksspshm, 49)); + __ASSERT_DEBUG(!Started(), User::Panic(KSpecAssert_ESockSSocksspshm, 49)); __ASSERT_DEBUG(iSubConnectionProvider.IsOpen(), User::Panic(KSpecAssert_ESockSSocksspshm, 50)); // legacy flows have no control side; should never get here //We will wait for it and complete the start after we have received it User::LeaveIfError(iStartRequest.Open(iSubConnectionProvider, aSender)); - if (iDCIdle != EClientsPresent) + if (Idle()) { iStartRequest.ReplyTo(Id(), TEBase::TError(TCFDataClient::TStart::Id(), KErrNotReady).CRef()); iStartRequest.Close(); @@ -1399,8 +1404,8 @@ { iStartRequest.ReplyTo(Id(), TCFDataClient::TStarted().CRef()); iStartRequest.Close(); - iIsStarted = ETrue; - iIsStopped = EFalse; + SetStarted(); + ClearStopped(); return; } @@ -1411,7 +1416,6 @@ void CTransportFlowShim::StopFlow(TCFDataClient::TStop& aMessage) { - __ASSERT_DEBUG(iIsStarted, User::Panic(KSpecAssert_ESockSSocksspshm, 51)); //Must be started now __ASSERT_DEBUG(iSubConnectionProvider.IsOpen(), User::Panic(KSpecAssert_ESockSSocksspshm, 52)); // legacy flows have no control side; should never get here // We need to error the socket if the lower protocol stack is not going to do this. Once a @@ -1425,7 +1429,11 @@ // RConnection but not transferring any data will not cause the TCP/IP stack to attach the flow // to the route and hence not call Error() if the interface comes down. - if (IsBoundToSession() && !iUseBearerErrors) + if (IsBoundToSession() && aMessage.iValue == KErrForceDisconnected) + { + Error(KErrDisconnected, EErrorAllOperations); + } + else if (IsBoundToSession() && !UseBearerErrors()) { Error(aMessage.iValue, EErrorAllOperations); } @@ -1438,14 +1446,14 @@ iLowerControl = NULL; iSubConnectionProvider.PostMessage(Id(), TCFDataClient::TStopped(aMessage.iValue).CRef()); - iIsStarted = EFalse; - iIsStopped = ETrue; + ClearStarted(); + SetStopped(); } void CTransportFlowShim::InitDestroy() { - __ASSERT_DEBUG(iDCIdle <= EClientsPresent, User::Panic(KSpecAssert_ESockSSocksspshm, 53)); - iDCIdle = EIdle; + __ASSERT_DEBUG(!(Idle() || IdleSent()), User::Panic(KSpecAssert_ESockSSocksspshm, 53)); + SetIdle(); if(iSubConnectionProvider.IsOpen()) // legacy flows have no control side { @@ -1473,8 +1481,8 @@ void CTransportFlowShim::PostDataClientRouted() { - if (iLocalAddressSet && iRemoteAddressSet - && iRemoteAddress.Family() != KAFUnspec && !iDataClientRoutedGuard) + if (LocalAddressSet() && RemoteAddressSet() + && iRemoteAddress.Family() != KAFUnspec && !DataClientRoutedGuard()) { iSubConnectionProvider.PostMessage( Id(), @@ -1486,16 +1494,10 @@ iIfInfo.iIAPId) ).CRef() ); - iDataClientRoutedGuard = ETrue; + SetDataClientRoutedGuard(); } } -void CTransportFlowShim::ClearDataClientRoutedGuard() - { - iDataClientRoutedGuard = EFalse; - } - - /* Store the provision information passed from the Control side. @param TProvisionConfig Message recd. @@ -1770,7 +1772,7 @@ } } - if(!IsStopped()) + if(!Stopped()) { // Prevent sending NoBearer if DataClientStop was received ParseNoBearerParams(aConnectionParams); if (iIsScoped) @@ -1807,7 +1809,7 @@ } PostNoBearer(); } - ClearUseBearerErrors(); + ClearDataClientRoutedGuard(); } else @@ -1887,7 +1889,7 @@ { SetPolicyCheckRequestPending(EFalse); - if (iDCIdle == EIdle) + if (Idle() && !IdleSent()) { ProcessDCIdleState(); } diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/test/TE_EsockTestSteps/src/ConnectionServer.TestSteps.cpp --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/ConnectionServer.TestSteps.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/ConnectionServer.TestSteps.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -20,6 +20,7 @@ #include #include "ConnectionServer.TestSteps.h" #include "networking\qos3gpp_subconparams.h" +#include // no longer available from qos3gpp_subconparams.h #include #ifdef _DEBUG diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionDummyNifTestSteps.cpp --- a/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionDummyNifTestSteps.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionDummyNifTestSteps.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -5195,10 +5195,12 @@ TESTEL(KErrNone == err, err); err = ConnectTcpSocket(sock, iEchoServerAddr); - TESTEL(KErrNone == err, err); - + // TimeOuts - unable to connect to ssock whis is down + TESTEL(KErrTimedOut == err, err); + err = TestTcpDataPathL(sock); - TESTEL(KErrNone == err, err); + TESTEL(KErrTimedOut == err, err); + DestroyUdpSocket(sock); CleanupStack::Pop(); diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/test/TE_Socket/SocketTestSection9.cpp --- a/datacommsserver/esockserver/test/TE_Socket/SocketTestSection9.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/test/TE_Socket/SocketTestSection9.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -601,3 +601,64 @@ return verdict; } +// Test step 9.9 +// +// Test ESoRecvOneOrMoreNoLength IPC +// +const TDesC& CSocketTest9_9::GetTestName() + { + _LIT(ret,"Test9.9"); + return ret; + } + +enum TVerdict CSocketTest9_9::InternalDoTestStepL( void ) + { + TVerdict verdict = EPass; + + Logger().WriteFormat(_L("Test Purpose: Test RecvOneOrMore (no length) API")); + + // connect to esock + Logger().WriteFormat(_L("Attempting to connect to socket server")); + RSocketServ ss; + TInt ret = OptimalConnect(ss); + CleanupClosePushL(ss); + Logger().WriteFormat(_L("Connect returned %S"), &EpocErrorToText(ret)); + TESTL(KErrNone == ret); + + RSocket sk; + Logger().WriteFormat(_L("Opening a socket on Dummy protocol 2")); + ret = sk.Open(ss, _L("Dummy Protocol 2")); + CleanupClosePushL(sk); + Logger().WriteFormat(_L("Open returned %S"), &EpocErrorToText(ret)); + TESTL(KErrNone == ret); + + Logger().WriteFormat(_L("Connecting socket")); + TSockAddr addr; + TRequestStatus rstat; + sk.Connect(addr, rstat); + User::WaitForRequest(rstat); + Logger().WriteFormat(_L("Connect status %S"), &EpocErrorToText(rstat.Int())); + TESTL(KErrNone == rstat.Int()); + + Logger().WriteFormat(_L("Trying RecvOneOrMore (no length)")); + TBuf8<10> buf; + sk.RecvOneOrMore(buf, 0, rstat); + TRequestStatus sstat; + _LIT8(KTestString, "Hello"); + sk.Send(KTestString(), 0, sstat); + User::WaitForRequest(rstat); + Logger().WriteFormat(_L("RecvOneOrMore status %S"), &EpocErrorToText(rstat.Int())); + TESTL(KErrNone == rstat.Int()); + User::WaitForRequest(sstat); + Logger().WriteFormat(_L("Send status %S"), &EpocErrorToText(sstat.Int())); + TESTL(KErrNone == sstat.Int()); + TESTL(buf == KTestString()); + + CleanupStack::Pop(&sk); + sk.Close(); + CleanupStack::Pop(&ss); + ss.Close(); + + SetTestStepResult(verdict); + return verdict; + } diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/test/TE_Socket/SocketTestSection9.h --- a/datacommsserver/esockserver/test/TE_Socket/SocketTestSection9.h Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/test/TE_Socket/SocketTestSection9.h Sun Mar 14 13:14:18 2010 +0000 @@ -76,5 +76,12 @@ static const TDesC& GetTestName(); virtual enum TVerdict InternalDoTestStepL( void ); }; + +class CSocketTest9_9 : public CSocketTestStep_OOMCapable + { + public: + static const TDesC& GetTestName(); + virtual enum TVerdict InternalDoTestStepL( void ); + }; #endif //(__SOCKETTEST_9_H__) diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/test/TE_Socket/TestSuiteSocket.cpp --- a/datacommsserver/esockserver/test/TE_Socket/TestSuiteSocket.cpp Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/test/TE_Socket/TestSuiteSocket.cpp Sun Mar 14 13:14:18 2010 +0000 @@ -179,6 +179,7 @@ ADD_TEST_STEP(CSocketTest9_6) ADD_TEST_STEP(CSocketTest9_7) ADD_TEST_STEP(CSocketTest9_8) + ADD_TEST_STEP(CSocketTest9_9) ADD_TEST_STEP(CSocketTest10_1) ADD_TEST_STEP(CSocketTest10_2) diff -r 09352266b4c6 -r e8bbc934663a datacommsserver/esockserver/test/TE_Socket/scriptfiles/te_socket_tests.script --- a/datacommsserver/esockserver/test/TE_Socket/scriptfiles/te_socket_tests.script Mon Mar 08 21:44:35 2010 +0000 +++ b/datacommsserver/esockserver/test/TE_Socket/scriptfiles/te_socket_tests.script Sun Mar 14 13:14:18 2010 +0000 @@ -245,6 +245,18 @@ RUN_TEST_STEP 10 TE_Socket Test9.8 z:\TestData\configs\te_socket.ini END_TESTCASE COMINF-ESOCK-Socket-0908 +START_TESTCASE COMINF-ESOCK-Socket-0909 +//! @SYMTestCaseID COMINF-ESOCK-Socket-0909 +//! @SYMTestCaseDesc Simple regression test of ESoRecvOneOrMoreNoLength IPC +//! @SYMTestActions Uses RSocket::RecvOneOrMore(TDes8&, TUint, TRequestStatus&) +//! @SYMTestExpectedResults Pass +//! @SYMTestPriority Critical +//! @SYMTestType CT +//! @SYMComponent comms-infras_esock +//! @SYMDEF DEF143623 +RUN_TEST_STEP 10 TE_Socket Test9.9 z:\TestData\configs\te_socket.ini +END_TESTCASE COMINF-ESOCK-Socket-0909 + START_TESTCASE COMINF-ESOCK-Socket-0137 //! @SYMTestCaseID COMINF-ESOCK-Socket-0137