# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277128942 -10800 # Node ID 07656293a99c5296aef410e9538f9a5c073e2b8c # Parent 35c06c1d4fa6c2bbbf5fbb0b26618d8410d9cc96 Revision: 201025 Kit: 2010125 diff -r 35c06c1d4fa6 -r 07656293a99c commsconfig/commsdatabaseshim/commdbshim/SCDB/commdb_impl.cpp --- a/commsconfig/commsdatabaseshim/commdbshim/SCDB/commdb_impl.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/commsconfig/commsdatabaseshim/commdbshim/SCDB/commdb_impl.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -362,7 +362,7 @@ User::LeaveIfError(recSet->iRecords.Append(aConnPref)); iCurrentRecord = recSet->iRecords[recSet->iRecords.Count()-1]; - iInsertedRecords.Insert(iCurrentRecord->RecordId(), KFirstRecord); + iInsertedRecords.InsertL(iCurrentRecord->RecordId(), KFirstRecord); TInt index = iDeletedRecords.Find(iCurrentRecord->RecordId()); @@ -451,7 +451,7 @@ CleanupStack::Pop(newRecord); iCurrentRecord = newRecord; - iInsertedRecords.Insert(iCurrentRecord->RecordId(), KFirstRecord); + iInsertedRecords.InsertL(iCurrentRecord->RecordId(), KFirstRecord); SortById(); aId = newRecord->RecordId(); diff -r 35c06c1d4fa6 -r 07656293a99c commsfwsupport/commselements/commsfw/src/cfutil.cpp --- a/commsfwsupport/commselements/commsfw/src/cfutil.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwsupport/commselements/commsfw/src/cfutil.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -493,14 +493,14 @@ } if(!found) { - files.Append(entry); + files.AppendL(entry); fullEntry.Set(entry.iName, &ff.File(), NULL); AddL(TOwnEntry(fullEntry, entry)); } } else { - files.Append(entry); + files.AppendL(entry); fullEntry.Set(entry.iName, &ff.File(), NULL); AddL(TOwnEntry(fullEntry, entry)); } diff -r 35c06c1d4fa6 -r 07656293a99c commsfwsupport/commselements/meshmachine/src/mm_node.cpp --- a/commsfwsupport/commselements/meshmachine/src/mm_node.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwsupport/commselements/meshmachine/src/mm_node.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -198,11 +198,11 @@ __ASSERT_DEBUG(!client->RecipientId().IsNull(), User::Panic(KSpecAssert_ElemMeshMachNodC, 1)); AbortActivitiesOriginatedBy(aContext, client->RecipientId()); + if (aContext.iSender == aClientId) + { + aContext.iPeer = NULL; + } ANodeBase::RemoveClient(foundAt); - if (aContext.iSender == aClientId) - { - aContext.iPeer = NULL; - } } EXPORT_C CNodeActivityBase* AMMNodeBase::FindActivityById(TUint aActivityId) const diff -r 35c06c1d4fa6 -r 07656293a99c commsfwsupport/commselements/serverden/bwins/serverdenu.def --- a/commsfwsupport/commselements/serverden/bwins/serverdenu.def Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwsupport/commselements/serverden/bwins/serverdenu.def Mon Jun 21 17:02:22 2010 +0300 @@ -138,7 +138,7 @@ ?IsShuttingDown@CCommonPitBoss@Den@@QBEHXZ @ 137 NONAME ; int Den::CCommonPitBoss::IsShuttingDown(void) const ?IsSubSessionIpcExtensionSupported@CWorkerSubSession@Den@@IAEPAVTIpcExtensionRoutingMessageFromSubSession@2@HAAVTDes8@@@Z @ 138 NONAME ; class Den::TIpcExtensionRoutingMessageFromSubSession * Den::CWorkerSubSession::IsSubSessionIpcExtensionSupported(int, class TDes8 &) ?LogSubSession@CWorkerSession@Den@@SAXPAV12@PAVCWorkerSubSession@2@HPAX@Z @ 139 NONAME ; void Den::CWorkerSession::LogSubSession(class Den::CWorkerSession *, class Den::CWorkerSubSession *, int, void *) - ?MaybeCompleteUnbinding@CCommonWorkerThread@Den@@IAEXG@Z @ 140 NONAME ; void Den::CCommonWorkerThread::MaybeCompleteUnbinding(unsigned short) + ?MaybeCompleteUnbinding@CCommonWorkerThread@Den@@IAEXGH@Z @ 140 NONAME ; void Den::CCommonWorkerThread::MaybeCompleteUnbinding(unsigned short) ?MaybeCompleteUnbindings@CCommonWorkerThread@Den@@QAEHXZ @ 141 NONAME ; int Den::CCommonWorkerThread::MaybeCompleteUnbindings(void) ?MaybeSetPlayerShutdownComplete@CCommonPlayer@Den@@QAEXH@Z @ 142 NONAME ; void Den::CCommonPlayer::MaybeSetPlayerShutdownComplete(int) ?MaybeSwitch@THeapSwitcher@Den@@AAEXAAVCCommonPitBoss@2@G@Z @ 143 NONAME ; void Den::THeapSwitcher::MaybeSwitch(class Den::CCommonPitBoss &, unsigned short) diff -r 35c06c1d4fa6 -r 07656293a99c commsfwsupport/commselements/serverden/eabi/serverdenu.def --- a/commsfwsupport/commselements/serverden/eabi/serverdenu.def Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwsupport/commselements/serverden/eabi/serverdenu.def Mon Jun 21 17:02:22 2010 +0300 @@ -149,7 +149,7 @@ _ZN3Den19CCommonWorkerThread20CompleteSessionCloseEPNS_14CWorkerSessionE @ 148 NONAME _ZN3Den19CCommonWorkerThread21DecProlongBindingLifeEv @ 149 NONAME _ZN3Den19CCommonWorkerThread21IncProlongBindingLifeEv @ 150 NONAME - _ZN3Den19CCommonWorkerThread22MaybeCompleteUnbindingEt @ 151 NONAME + _ZN3Den19CCommonWorkerThread22MaybeCompleteUnbindingEti @ 151 NONAME _ZN3Den19CCommonWorkerThread23MaybeCompleteUnbindingsEv @ 152 NONAME _ZN3Den19CCommonWorkerThread25SetDealerShutdownCompleteEi @ 153 NONAME _ZN3Den19CCommonWorkerThread25SetPlayerShutdownCompleteEi @ 154 NONAME @@ -379,4 +379,3 @@ _ZNK3Den18RApiExtSessionBase4SendERNS_13TApiExtReqMsgERK11RHandleBaseR14TRequestStatus @ 378 NONAME _ZNK3Den21RApiExtSubSessionBase4SendERNS_13TApiExtReqMsgERK11RHandleBaseR14TRequestStatus @ 379 NONAME - diff -r 35c06c1d4fa6 -r 07656293a99c commsfwsupport/commselements/serverden/inc/sd_thread.h --- a/commsfwsupport/commselements/serverden/inc/sd_thread.h Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwsupport/commselements/serverden/inc/sd_thread.h Mon Jun 21 17:02:22 2010 +0300 @@ -269,7 +269,7 @@ void ProcessIniDataL(); IMPORT_C TInt DecodePeerId(const CommsFW::TCFSubModuleAddress* aSubModule1, const CommsFW::TCFSubModuleAddress* aSubModule2, CommsFW::TWorkerId& aPeerId); - IMPORT_C void MaybeCompleteUnbinding(CommsFW::TWorkerId aWorker); + IMPORT_C void MaybeCompleteUnbinding(CommsFW::TWorkerId aWorker, TBool aPeerIsDead); protected: /** This is the handler used for bi-directional communication with the Root Server. */ diff -r 35c06c1d4fa6 -r 07656293a99c commsfwsupport/commselements/serverden/src/sd_workerthread.cpp --- a/commsfwsupport/commselements/serverden/src/sd_workerthread.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwsupport/commselements/serverden/src/sd_workerthread.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -454,7 +454,7 @@ #endif // Mark the peer handler as unbinding - __CFLOG_VAR(( KECommonComponentTag, KECommonServerTag, _L8("W%d: CFUnbindMessageReceived %S <=> %S"), + COMMONLOG((WorkerId(), KECommonBootingTag, _L8("W%d: CFUnbindMessageReceived %S <=> %S"), WorkerId(), &fullModName1, &fullModName2 )); @@ -483,7 +483,7 @@ { iTransport->SetLastRequestIdConcerningPeer(unbindId, aMsg.Identifier()); iTransport->SetDropTransportPending(unbindId, ETrue); - MaybeCompleteUnbinding(unbindId); + MaybeCompleteUnbinding(unbindId, aMsg.PeerIsDead()); } else { @@ -507,7 +507,7 @@ // We always have a transport to ourself & it needs no unbinding if(player != WorkerId()) { - MaybeCompleteUnbinding(player); + MaybeCompleteUnbinding(player, EFalse); if(iTransport->PeerReachable(player)) { return EFalse; @@ -526,13 +526,13 @@ @see CCommonPlayer::CanUnbindFromWorker @see TCFUnbindCompleteMsg */ -EXPORT_C void CCommonWorkerThread::MaybeCompleteUnbinding(TWorkerId aWorker) +EXPORT_C void CCommonWorkerThread::MaybeCompleteUnbinding(TWorkerId aWorker, TBool aPeerIsDead) { if(iTransport->PeerReachable(aWorker) && iTransport->IsDropTransportPending(aWorker)) { - if(!Dealer() || Dealer()->CanUnbindFromWorker(aWorker)) + if(aPeerIsDead || !Dealer() || Dealer()->CanUnbindFromWorker(aWorker)) { - if(!Player() || Player()->CanUnbindFromWorker(aWorker)) + if(aPeerIsDead || !Player() || Player()->CanUnbindFromWorker(aWorker)) { COMMONLOG((WorkerId(), KECommonBootingTag, _L8("CCommonWorkerThread::MaybeCompleteUnbinding(%d) - dropping transport & unbinding"), aWorker)); // Let the peer know that we've unbound - if it has management responsibility towards us then @@ -719,7 +719,7 @@ if(iTransport->PeerReachable(peerId)) { - MaybeCompleteUnbinding(peerId); + MaybeCompleteUnbinding(peerId, ETrue); if(iTransport->PeerReachable(peerId)) { COMMONLOG((iWorkerId, KECommonServerTag, _L8("Destroying peer #%d handler"),peerId)); diff -r 35c06c1d4fa6 -r 07656293a99c commsfwtools/preparedefaultcommsdatabase/Tools/ced/inc/CXMLContentHandler.h --- a/commsfwtools/preparedefaultcommsdatabase/Tools/ced/inc/CXMLContentHandler.h Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwtools/preparedefaultcommsdatabase/Tools/ced/inc/CXMLContentHandler.h Mon Jun 21 17:02:22 2010 +0300 @@ -275,7 +275,7 @@ public: // Functions to manipulate the database elements - void AddTableEntry(CXMLTableEntry* aEntry); + void AddTableEntryL(CXMLTableEntry* aEntry); CXMLTableEntry* GetTableEntry(const TInt aIndex); TInt GetNumberTableEntries() const; CXMLTableEntry* GetLastTableEntry(); diff -r 35c06c1d4fa6 -r 07656293a99c commsfwtools/preparedefaultcommsdatabase/Tools/ced/src/CXMLContentHandler.cpp --- a/commsfwtools/preparedefaultcommsdatabase/Tools/ced/src/CXMLContentHandler.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwtools/preparedefaultcommsdatabase/Tools/ced/src/CXMLContentHandler.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -507,7 +507,7 @@ gMsg->Msg(_L("Create new table entry for table : [%S] with operation (%S)"), &iCurrentTableName, &operation); - iXmlDb->AddTableEntry(tableEntry); + iXmlDb->AddTableEntryL(tableEntry); return; } @@ -1475,11 +1475,11 @@ { TBuf* name = new(ELeave) TBuf; name->Copy(aParamName); - paramName.Append(name); + paramName.AppendL(name); TBuf* value = new(ELeave) TBuf; value->Copy(aParamValue); - paramValue.Append(value); + paramValue.AppendL(value); } // Remove a parameter from the list @@ -1530,11 +1530,11 @@ } // Add a table entry to the database given the pointer -void CXMLDatabase::AddTableEntry(CXMLTableEntry* aEntry) +void CXMLDatabase::AddTableEntryL(CXMLTableEntry* aEntry) { if(aEntry != NULL) { - tableEntries.Append(aEntry); + tableEntries.AppendL(aEntry); } } diff -r 35c06c1d4fa6 -r 07656293a99c commsfwtools/preparedefaultcommsdatabase/Tools/ced/src/ced.cpp --- a/commsfwtools/preparedefaultcommsdatabase/Tools/ced/src/ced.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwtools/preparedefaultcommsdatabase/Tools/ced/src/ced.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -875,7 +875,7 @@ if ( !bInFound ) { RFs fs; - fs.Connect(); + User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); TUint dummy; diff -r 35c06c1d4fa6 -r 07656293a99c commsfwtools/preparedefaultcommsdatabase/src/MetaDatabaseVisitor.cpp --- a/commsfwtools/preparedefaultcommsdatabase/src/MetaDatabaseVisitor.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwtools/preparedefaultcommsdatabase/src/MetaDatabaseVisitor.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -235,7 +235,7 @@ { if ( KErrNotFound == fieldIds.Find(aRecordIds[i], CompareByRecordId) ) { - aCandidateIds.Append(aRecordIds[i]); + aCandidateIds.AppendL(aRecordIds[i]); } } CleanupStack::PopAndDestroy(&fieldIds); diff -r 35c06c1d4fa6 -r 07656293a99c commsfwutils/commsbufs/mbufmgr/src/mb_chn.cpp --- a/commsfwutils/commsbufs/mbufmgr/src/mb_chn.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/commsfwutils/commsbufs/mbufmgr/src/mb_chn.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -281,7 +281,7 @@ if(First()) { newChain.iNext = First()->Pool()->Pond().Alloc(len + aHdrReserve, 0, KMaxTInt); - err = iNext ? KErrNone : KErrNoMBufs; + err = newChain.iNext ? KErrNone : KErrNoMBufs; } else { diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/CoreProviders/src/coremcpractivities.cpp --- a/datacommsserver/esockserver/CoreProviders/src/coremcpractivities.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/CoreProviders/src/coremcpractivities.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -689,7 +689,7 @@ CSelectNextLayerActivity& ac = static_cast(*iContext.iNodeActivity); TCFSelector::TSelectComplete& msg = message_cast(iContext.iMessage); - ac.iSelectCompleteMessages.Append(msg); + ac.iSelectCompleteMessages.AppendL(msg); } EXPORT_DEFINE_SMELEMENT(CSelectNextLayerActivity::TJoinTierManager, NetStateMachine::MStateTransition, CSelectNextLayerActivity::TContext) diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/core_states/ss_corepractivities.cpp --- a/datacommsserver/esockserver/core_states/ss_corepractivities.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/core_states/ss_corepractivities.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -1113,7 +1113,7 @@ { __ASSERT_DEBUG(aDataClient, User::Panic(KCorePrPanic, KPanicDataClient)); __ASSERT_DEBUG(iSuccessfulDataClients.Find(aDataClient) == KErrNotFound, User::Panic(KCorePrPanic, KPanicIncorrectState)); - iSuccessfulDataClients.Append(aDataClient); + iSuccessfulDataClients.AppendL(aDataClient); } void CBindToActivity::RemoveClientFromSuccessful(Messages::RNodeInterface* aDataClient) diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/core_states/ss_coreprstates.cpp --- a/datacommsserver/esockserver/core_states/ss_coreprstates.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/core_states/ss_coreprstates.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -540,7 +540,7 @@ } else { - __CFLOG_VAR((KCoreProviderStatesTag, KCoreProviderStatesSubTag, _L8("TSendDestroyToSendingDataClient::DoL - client not destroyed, because it is started or has been requested again"))); + __CFLOG_VAR((KCoreProviderStatesTag, KCoreProviderStatesSubTag, _L8("TSendDestroyToSendingDataClient::DoL - client not destroyed, because it is started or has been requested again [flags %x]"), iContext.iPeer->Flags())); TSendDataClientIdleIfNoClients(iContext).DoL(); } } diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/inc/ss_connstates.h --- a/datacommsserver/esockserver/inc/ss_connstates.h Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/inc/ss_connstates.h Mon Jun 21 17:02:22 2010 +0300 @@ -373,6 +373,7 @@ virtual ~CStartAttachActivity(); virtual TBool Next(MeshMachine::TNodeContextBase& aContext); + virtual void Cancel(MeshMachine::TNodeContextBase& aContext); void ReturnInterfacePtrL(CoreActivities::ABindingActivity*& aInterface) { diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/ssock/ss_conn.cpp --- a/datacommsserver/esockserver/ssock/ss_conn.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/ssock/ss_conn.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -267,8 +267,7 @@ // Handshake a shutdown of AllInterfaceNotificationWorker (send TCancel, await TError). NODEACTIVITY_ENTRY(ConnStates::KCancelAllInterfaceWorker, ConnStates::TCancelAllInterfaceNotificationWorker, TAwaitingMessageState, MeshMachine::TNoTag) THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TCancelAllLegacyRMessage2Activities, ConnStates::TNoTagBlockedByLegacyRMessage2Activities) - NODEACTIVITY_ENTRY(KNoTag, ConnStates::TProcessClose, TECABState, MeshMachine::TNoTag) - //TDestroyAwaitingLeaveCompleteLoop loops back to its own triple if more SPs + THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TProcessClose, MeshMachine::TNoTag) NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, TECABState, CoreActivities::CDestroyActivity::TNoTagOrNoTagBackwards) LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing) NODEACTIVITY_END() diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/ssock/ss_connselect.cpp --- a/datacommsserver/esockserver/ssock/ss_connselect.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/ssock/ss_connselect.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -131,11 +131,10 @@ { RNodeInterface::OpenPostMessageClose(Id(), aSender, TEChild::TLeft().CRef()); iActiveRequests[idx].SetFlags(TClientType::ELeaving); - } - - if (aSender == iTopMcprId) - { - iTopMcprId.SetNull(); + if (aSender == iTopMcprId) + { + iTopMcprId.SetNull(); + } } } SelectionError(aSender, error.iValue); @@ -260,9 +259,18 @@ __ASSERT_DEBUG(!iDestroying, User::Panic(KSpecAssert_ESockSSockscnslc, 17)); iDestroying = ETrue; - //We are not ready to destruct ourselves yet, waiting for TErrors if (iActiveRequests.Count()!=0) { + /* + Unfortunatelly today the parent of 'this' (CConnection or CFlowRequest) doesn't handle ownership + with 'this' very well and it may (in cancelation scenarios it will) bail out right after posting TDestroy + to 'this'. This is not good because the TSelect protocol carries data owned by the parent (selection preferences) + and MCPRs may attempt to access them after the owner/parent has gone away. We're making it illegal for the + parent to post TDestroy before all requests are completed. Consequently before posting TDestroy the parent + must make sure the selection is complete by awaiting response to the TSelect protocol. If it wants to + terminate selection it _must_ send TCancel (and await responses) before posting TDestroy. + */ + __ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ESockSSockscnslc, 44)); return; } diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/ssock/ss_connstates.cpp --- a/datacommsserver/esockserver/ssock/ss_connstates.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/ssock/ss_connstates.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -927,6 +927,20 @@ return nextRet; } +void ConnActivities::CStartAttachActivity::Cancel(MeshMachine::TNodeContextBase& aContext) + { + if (!iCSR.IsNull() && iCSR == PostedToNodeId()) + {//iCSR is a bit akward as it isn't stored in the Node's client array. MeshMachine auto-cancelling refuses to auto-forward TCancels + //to nodes it can't verify they are alive. CStartAttachActivity can warrant iCSR is alive. + RClientInterface::OpenPostMessageClose(TNodeCtxId(ActivityId(), iNode.Id()), PostedToNodeId(), TEBase::TCancel().CRef()); + SetError(KErrCancel); + } + else + { + CESockClientActivityBase::Cancel(aContext); + } + } + DEFINE_SMELEMENT(CStartAttachActivity::TNoTagOrStartPrefsSetTag, NetStateMachine::MStateFork, ConnStates::TContext) TInt CStartAttachActivity::TNoTagOrStartPrefsSetTag::TransitionTag() diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/ssock/ss_intsock.cpp --- a/datacommsserver/esockserver/ssock/ss_intsock.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/ssock/ss_intsock.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -2012,7 +2012,14 @@ // __ASSERT_DEBUG(State()!=ESStateCreated,Panic(EBadStateUpCall)); // no longer forced into shuttingdown state upon half-close __ASSERT_DEBUG(State()!=ESStateClosing,Panic(EBadStateUpCall)); __ASSERT_DEBUG(!(iBlockedOperations&EReadStopped),Panic(EBadStateUpCall)); - __ASSERT_DEBUG(State()!=ESStateError,Panic(EBadStateUpCall)); + + // The socket can now be errored from the control side as well as from the protocol below. Hence, the socket + // can receive an upcall while in the errored state as the protocol is unaware of the socket errored state. + // Specific scenario is that TransportFlowShim receives a DataClientStop(KErrForceDisconnect), places the socket + // in the errored state and, subsequently, the TCP/IP stack issues NewData(KNewDataEndofData) as a result of an + // incoming FIN. + //__ASSERT_DEBUG(State()!=ESStateError,Panic(EBadStateUpCall)); + __ASSERT_DEBUG(State()!=ESStateDisconnected,Panic(EBadStateUpCall)); // zero is used in v1.5 to resume after reneging __ASSERT_DEBUG(aCount>0,Panic(EBadDataCount)); @@ -2056,7 +2063,8 @@ __ASSERT_DEBUG(State()!=ESStateCreated,Panic(EBadStateUpCall)); __ASSERT_DEBUG(State()!=ESStateClosing,Panic(EBadStateUpCall)); __ASSERT_DEBUG(State()!=ESStateShuttingDown,Panic(EBadStateUpCall)); - __ASSERT_DEBUG(State()!=ESStateError,Panic(EBadStateUpCall)); + // See comment in ASocket::NewData() as to why the errored state is valid here. + //__ASSERT_DEBUG(State()!=ESStateError,Panic(EBadStateUpCall)); __ASSERT_DEBUG(State()!=ESStateDisconnected,Panic(EBadStateUpCall)); TBool writeflowedoff = iBlockedOperations&EWriteFlowedOff; @@ -2080,7 +2088,11 @@ //__ASSERT_DEBUG(State()==ESStateOpeningActive,Panic(EBadStateUpCall)); if (IsConnectionOriented()) { - SetState(ESStateConnected); + // See comment in ASocket::NewData() as to why the errored state is valid here. + if (State() != ESStateError) + { + SetState(ESStateConnected); + } //__ASSERT_DEBUG(IsBlockedConnect(), Panic(EUnexpectedConnect)); // assertion is invalid because operation could have been cancelled MarkT CompleteConnect(KErrNone); @@ -2112,7 +2124,8 @@ Called from protocol to indicate that a passive open has completed */ { - __ASSERT_DEBUG(State()==ESStateOpeningPassive,Panic(EBadStateUpCall)); + // See comment in ASocket::NewData() as to why the errored state is valid here. + __ASSERT_DEBUG(State()==ESStateOpeningPassive || State()==ESStateError,Panic(EBadStateUpCall)); __ASSERT_ALWAYS(iAcceptQ, Panic(ENotListeningSocket)); __ASSERT_ALWAYS(iAcceptQ->Count()Length(), Panic(EAcceptQueFull)); @@ -2296,11 +2309,15 @@ */ { __ASSERT_ALWAYS(IsConnectionOriented(),Panic(EBadDisconnect)); - __ASSERT_DEBUG(State()==ESStateConnected || State()==ESStateShuttingDown,Panic(EBadStateUpCall)); + // See comment in ASocket::NewData() as to why the errored state is valid here. + __ASSERT_DEBUG(State()==ESStateConnected || State()==ESStateShuttingDown || State()==ESStateError, Panic(EBadStateUpCall)); iDisconnectDataError=KErrNone; - SetState(CanReconnect() ? ESStateCreated : ESStateDisconnected); + if (State() != ESStateError) + { + SetState(CanReconnect() ? ESStateCreated : ESStateDisconnected); + } CompleteWrite(KErrDisconnected); CompleteRead(KErrDisconnected); CompleteConnect(KErrDisconnected); @@ -2313,7 +2330,8 @@ */ { __ASSERT_DEBUG(IsConnectionOriented(),Panic(EBadDisconnect)); - __ASSERT_DEBUG(State()==ESStateConnected || State()==ESStateShuttingDown,Panic(EBadStateUpCall)); + // See comment in ASocket::NewData() as to why the errored state is valid here. + __ASSERT_DEBUG(State()==ESStateConnected || State()==ESStateShuttingDown || State()==ESStateError,Panic(EBadStateUpCall)); Disconnect(); iDisconnectData=aDisconnectData.Alloc(); diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/ssock/ss_sap.cpp --- a/datacommsserver/esockserver/ssock/ss_sap.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/ssock/ss_sap.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -227,6 +227,10 @@ { SetIdle(); ProcessDCIdleState(); + if(!IdleSent()) + { + LOG( ESockLog::Printf(_L("CNetworkFlow %08x:\tUnbind() - idle not sent"), this) ); + } } } else @@ -255,6 +259,10 @@ if (Idle() && !IdleSent() && !NoBearerGuard()) #endif { + if(Started()) + { + iSubConnectionProvider.PostMessage(Id(), TCFControlProvider::TDataClientGoneDown(KErrConnectionTerminated).CRef()); + } SetIdleSent(); iSubConnectionProvider.PostMessage(Id(), TCFControlProvider::TIdle().CRef()); } diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_003.ini --- a/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_003.ini Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_003.ini Mon Jun 21 17:02:22 2010 +0300 @@ -18,6 +18,9 @@ SNAP=30 Asynch=TRUE +[WaitUntilStuffStucks] +TimeoutInMilliSeconds=600 + [StopConn1] ConnName=Conn1 ConnStopType=EStopNormal diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_010.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_010.ini Mon Jun 21 17:02:22 2010 +0300 @@ -0,0 +1,29 @@ +[CreateSockSvr1] +SocketServName=SockSvr1 + +[CreateConn1] +ConnName=Conn1 + +[ConnectSockSvr1] +SocketServName=SockSvr1 + +[OpenConn1] +ConnName=Conn1 +SocketServName=SockSvr1 +ConnType=271069227 + +[StartConn1] +ConnName=Conn1 +SocketServName=SockSvr1 +SNAP=10 +ConnType=271069227 + +[StopConn1] +ConnName=Conn1 +ConnStopType=EStopNormal + +[CloseConn1] +ConnName=Conn1 + +[CloseSockSvr1] +SocketServName=SockSvr1 \ No newline at end of file diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby --- a/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby Mon Jun 21 17:02:22 2010 +0300 @@ -28,6 +28,8 @@ data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_005.script TestData\scripts\te_dummyprovider_005.script data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_006.script TestData\scripts\te_dummyprovider_006.script data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_008.script TestData\scripts\te_dummyprovider_008.script +data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_008.script TestData\scripts\te_dummyprovider_009.script +data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_008.script TestData\scripts\te_dummyprovider_010.script data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_incomingSCPR.script TestData\scripts\te_dummyprovider_incomingSCPR.script data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyproviders.cfg TestData\configs\te_dummyproviders.cfg @@ -38,5 +40,7 @@ data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_005.ini TestData\configs\te_dummyprovider_005.ini data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_006.ini TestData\configs\te_dummyprovider_006.ini data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_008.ini TestData\configs\te_dummyprovider_008.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_008.ini TestData\configs\te_dummyprovider_009.ini +data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_008.ini TestData\configs\te_dummyprovider_010.ini #endif // __TE_DummyProviders_IBY__ diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf --- a/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf Mon Jun 21 17:02:22 2010 +0300 @@ -28,11 +28,11 @@ ../scripts/te_dummyprovider_004.script z:/testdata/scripts/te_dummyprovider_004.script ../scripts/te_dummyprovider_005.script z:/testdata/scripts/te_dummyprovider_005.script ../scripts/te_dummyprovider_006.script z:/testdata/scripts/te_dummyprovider_006.script +../scripts/te_dummyprovider_008.script z:/testdata/scripts/te_dummyprovider_008.script ../scripts/te_dummyprovider_009.script z:/testdata/scripts/te_dummyprovider_009.script +../scripts/te_dummyprovider_010.script z:/testdata/scripts/te_dummyprovider_010.script -../scripts/te_dummyprovider_008.script z:/testdata/scripts/te_dummyprovider_008.script - ../scripts/te_dummyprovider_incomingSCPR.script z:/testdata/scripts/te_dummyprovider_incomingSCPR.script ../configs/te_dummyproviders.cfg z:/testdata/configs/te_dummyproviders.cfg ../configs/te_dummyprovider_001.ini z:/testdata/configs/te_dummyprovider_001.ini @@ -41,8 +41,7 @@ ../configs/te_dummyprovider_004.ini z:/testdata/configs/te_dummyprovider_004.ini ../configs/te_dummyprovider_005.ini z:/testdata/configs/te_dummyprovider_005.ini ../configs/te_dummyprovider_006.ini z:/testdata/configs/te_dummyprovider_006.ini +../configs/te_dummyprovider_008.ini z:/testdata/configs/te_dummyprovider_008.ini ../configs/te_dummyprovider_009.ini z:/testdata/configs/te_dummyprovider_009.ini +../configs/te_dummyprovider_010.ini z:/testdata/configs/te_dummyprovider_010.ini ../configs/TE_DummyProvider_ip.tcpip.esk z:/testdata/configs/TE_DummyProvider_ip.tcpip.esk - - -../configs/te_dummyprovider_008.ini z:/testdata/configs/te_dummyprovider_008.ini diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script --- a/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script Mon Jun 21 17:02:22 2010 +0300 @@ -34,6 +34,8 @@ RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_006.script RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_008.script RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_009.script +RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_010.script + RUN_SCRIPT z:\testdata\scripts\te_esock_test_unloadesockForced.script RUN_SCRIPT z:\testdata\scripts\te_esock_test_remove_config_files.script diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_003.script --- a/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_003.script Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_003.script Mon Jun 21 17:02:22 2010 +0300 @@ -32,6 +32,10 @@ RUN_TEST_STEP 100 te_esockteststepsSuite connectrsocketservStep z:\testdata\configs\te_dummyprovider_003.ini ConnectSockSvr1 RUN_TEST_STEP 100 te_esockteststepsSuite openrconnectionStep z:\testdata\configs\te_dummyprovider_003.ini OpenConn1 RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_003.ini StartConn1 + +//Let the test get stuck where we want to get stuck first (otherwise we may be cancelling prematurely). +RUN_TEST_STEP 100 te_esockteststepsSuite waitStep z:\testdata\configs\te_dummyprovider_003.ini WaitUntilStuffStucks + RUN_TEST_STEP 100 te_esockteststepsSuite stoprconnectionStep z:\testdata\configs\te_dummyprovider_003.ini StopConn1 RUN_TEST_STEP 100 te_esockteststepsSuite AwaitRConnectionStartComplete z:\testdata\configs\te_dummyprovider_003.ini WaitStartComplete1 RUN_TEST_STEP 100 te_esockteststepsSuite closerconnectionStep z:\testdata\configs\te_dummyprovider_003.ini CloseConn1 diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_010.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_010.script Mon Jun 21 17:02:22 2010 +0300 @@ -0,0 +1,48 @@ +// +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRINT Running CASE010 +PRINT Two dummy layers able to start successfully +PRINT Execute the crazy start/wait/stop loop increasing wait with every iteration. +PRINT See how the stack manages cancelations at distinct stages. + + +// +LOAD_SUITE te_esockteststepsSuite -SharedData +RUN_SCRIPT z:\TestData\scripts\te_esock_test_loadesock.script + +START_TESTCASE COMINF-ESOCK-DummyProviders-010 +//! @SYMTestCaseID COMINF-ESOCK-DummyProviders-010 +//! @SYMTestCaseDesc Tests the resiliance of the RConnection::Start to cancelations (induced by RConnection::Stop). +//! @SYMTestActions Execute the crazy start/wait/stop loop increasing wait with every iteration. +//! @SYMTestExpectedResults No crashes, all operations complete (typically with KErrCancel, but that's not cared for) +//! @SYMTestPriority Critical +//! @SYMTestType CT +//! @SYMComponent comms-infras_esock + +RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketservStep z:\testdata\configs\te_dummyprovider_010.ini CreateSockSvr1 +RUN_TEST_STEP 100 te_esockteststepsSuite createrconnectionStep z:\testdata\configs\te_dummyprovider_010.ini CreateConn1 +RUN_TEST_STEP 100 te_esockteststepsSuite connectrsocketservStep z:\testdata\configs\te_dummyprovider_010.ini ConnectSockSvr1 +RUN_TEST_STEP 100 te_esockteststepsSuite openrconnectionStep z:\testdata\configs\te_dummyprovider_010.ini OpenConn1 +RUN_TEST_STEP 100 te_esockteststepsSuite StartStopCrazyLoopRConnectionStep z:\testdata\configs\te_dummyprovider_010.ini StartConn1 +RUN_TEST_STEP 100 te_esockteststepsSuite closerconnectionStep z:\testdata\configs\te_dummyprovider_010.ini CloseConn1 +RUN_TEST_STEP 100 te_esockteststepsSuite closersocketservStep z:\testdata\configs\te_dummyprovider_010.ini CloseSockSvr1 +RUN_TEST_STEP 100 te_esockteststepsSuite cleanallStep +END_TESTCASE COMINF-ESOCK-DummyProviders-010 + +RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script + +PRINT Completed CASE010 diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h Mon Jun 21 17:02:22 2010 +0300 @@ -173,12 +173,36 @@ TVerdict doSingleTestStep(); TInt ConfigureFromIni(); -private: +protected: TRConnectionParams iParams; //current params (.ini) }; _LIT(KStartRConnectionStep,"StartRConnectionStep"); +/** +Class implementing StartStopCrazyLoopRConnectionStep +The test does a loop, where every iteration: +(1) Starts the connection +(2) Snoozes for an +(3) Stops the connection injecting a cancel at that stage of the connection start +(4) Increases the a bit so that next time round the cancel is injected at a different stage. + +Note that since the test is normally executed by a thread of lower priority than ESock_IP, it relies on +ESock_IP yielding (otherwise it won't test different phases. +For instance DummyMCPR will artificially yield on TCFServiceProvider::TJoinRequest. +NetMCPR will not normally yield as is. + +@internalComponent +*/ +class CStartStopCrazyLoopRConnectionStep : public CStartRConnectionStep + { +public: + CStartStopCrazyLoopRConnectionStep(CCEsockTestBase*& aEsockTest); + TVerdict doSingleTestStep(); + TInt CalibrateStart(); + }; + +_LIT(KStartStopCrazyLoopRConnectionStep,"StartStopCrazyLoopRConnectionStep"); /** Class implementing openrconnectionStep @@ -444,6 +468,20 @@ _LIT(KGetParameters_IntStep,"GetParameters_IntStep"); + +class CWaitStep : public CTe_EsockStepBase + { +public: + CWaitStep(CCEsockTestBase*& aEsockTest); + TVerdict doSingleTestStep(); + TInt ConfigureFromIni(); +private: + TInt iTimeOutMs; + }; + +_LIT(KWaitStep,"WaitStep"); + + #endif // CONNECTIONS_TESTSTEPS_H diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h Mon Jun 21 17:02:22 2010 +0300 @@ -502,6 +502,7 @@ //connection functions library RConnection* FindConnection(const TDesC& aConnectionName); TInt CreateConnection(const TDesC& aConnectionName); + TInt RemoveConnection(const TDesC& aConnectionName); TInt OpenConnection(const TRConnectionParams& aParams); TInt StartConnection(RConnection& aConn, TConnPref& aPrefs, TRequestStatus* aRequestStatus); TInt StartConnection(TRConnectionParams& aParams); diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -112,9 +112,9 @@ // Optional // Reads the protocol family to use - if (GetIntFromConfig(iSection, KTe_ConnectionType, iParams.iConnectionType) != 1) + if (!GetIntFromConfig(iSection, KTe_ConnectionType, iParams.iConnectionType)) { - iParams.iConnectionType = -1; + iParams.iConnectionType = -1; } // All ok if we got this far @@ -155,6 +155,14 @@ INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); return KErrNotFound; } + + GetStringFromConfig(iSection, KTe_SocketServName, iParams.iSockServName); + // Optional + // Reads the protocol family to use + if (!GetIntFromConfig(iSection, KTe_ConnectionType, iParams.iConnectionType)) + { + iParams.iConnectionType = -1; + } TPtrC16 bearerSet; TBool bearerPresent = ((GetStringFromConfig(iSection,KTe_BearerName,bearerSet)==1) @@ -251,6 +259,152 @@ } + + + + + + + +// CStartStopCrazyLoopRConnectionStep +//----------------- + +CStartStopCrazyLoopRConnectionStep::CStartStopCrazyLoopRConnectionStep(CCEsockTestBase*& aEsockTest) +: CStartRConnectionStep(aEsockTest) + { + SetTestStepName(KStartStopCrazyLoopRConnectionStep); + } + +TInt CStartStopCrazyLoopRConnectionStep::CalibrateStart() + { + TTime timeBegin; + TTime timeEnd; + + TRequestStatus* pConnectionStartStatus = iEsockTest->iRequestStatuses.Find(iParams.iConnectionName); + if (pConnectionStartStatus == NULL) + { + return KErrCorrupt; + } + + timeBegin.HomeTime(); + TInt error = iEsockTest->StartConnection(iParams); + if (error != KErrNone) + { + return error; + } + User::WaitForRequest(*pConnectionStartStatus); + if (pConnectionStartStatus->Int() != KErrNone) + { + return pConnectionStartStatus->Int(); + } + timeEnd.HomeTime(); + iEsockTest->StopConnection(iParams); + return timeEnd.MicroSecondsFrom(timeBegin).Int64(); + } + + +TVerdict CStartStopCrazyLoopRConnectionStep::doSingleTestStep() + { + // Default to failing + SetTestStepResult(EFail); + iParams.iAsynch = ETrue; //force async. + RTimer timer; + TInt error = timer.CreateLocal(); + if (error!=KErrNone) + { + INFO_PRINTF2(_L("Creating RTimer object failed with %d"), error); + return TestStepResult(); + } + + TRequestStatus timerRequestStatus; + TRequestStatus* pConnectionStartStatus = new TRequestStatus; + if (pConnectionStartStatus == NULL) + { + INFO_PRINTF1(_L("Heap allocation for TRequestStatus failed")); + timer.Close(); + return TestStepResult(); + } + error = iEsockTest->iRequestStatuses.Add(pConnectionStartStatus, iParams.iConnectionName); + if (error!=KErrNone) + { + INFO_PRINTF2(_L("Failed "), error); + timer.Close(); + delete pConnectionStartStatus; + return TestStepResult(); + } + TRequestStatus& connectionStartStatus = *pConnectionStartStatus; + + const TInt KLoops = 10; + INFO_PRINTF1(_L("Calibrating timer by running full start")); + //Well, we're running the full start twice as the first run is likely to take more than the representative time. + TInt timerIncrement = Min(CalibrateStart(), CalibrateStart()); + if (timerIncrement < 0) + { + INFO_PRINTF2(_L("Full start failed, unable to calibrate, test failed with %d"), timerIncrement); + return TestStepResult(); + } + INFO_PRINTF3(_L("Start took %dus, will divide by %d and use as the increment"), timerIncrement, KLoops); + + + TInt timerVal = 1; + timerIncrement /= KLoops; + + INFO_PRINTF1(_L("Beginning crazy start/stop loop")); + + for (TInt i = 1; i < KLoops+1; i++) + { + INFO_PRINTF2(_L("[Loop %d], Starting a new loop=============================="), i); + INFO_PRINTF2(_L("[Loop %d], Closing connection"), i); + iEsockTest->CloseConnection(iParams.iConnectionName); + INFO_PRINTF2(_L("[Loop %d], Re-openning connection"), i); + if (iEsockTest->OpenConnection(iParams) != KErrNone) + { + INFO_PRINTF1(_L("Can't reopen connection, most likely you didn't supply the session name")); + timer.Close(); + return TestStepResult(); + } + INFO_PRINTF2(_L("[Loop %d], Starting connection (asynch)"), i); + error = iEsockTest->StartConnection(iParams); + if (error != KErrNone) + { + INFO_PRINTF1(_L("Starting connection failed, aborting")); + timer.Close(); + return TestStepResult(); + } + INFO_PRINTF3(_L("[Loop %d], Setting timer to %dus .zzz...."), i, timerVal); + timer.After(timerRequestStatus,timerVal); + User::WaitForRequest(timerRequestStatus,connectionStartStatus); + if (timerRequestStatus.Int() == KRequestPending) + { + INFO_PRINTF2(_L("Connection Start completed with %d"), connectionStartStatus.Int()); + INFO_PRINTF1(_L("Irrespective of the start result the test has failed, because it hadn't execute enough iterations")); + //If you get this a lot this means there;s a flaw in the logic of this test and for some reason the execution of + //RConnection::Start speeds up with time. You may want to re-calibrate then and rerun the loop again with finer + //interval. + timer.Cancel(); + User::WaitForRequest(timerRequestStatus); + timer.Close(); + return TestStepResult(); + } + + timerVal += timerIncrement; + INFO_PRINTF2(_L("[Loop %d], ....zzz. Stopping connection"), i); + iEsockTest->StopConnection(iParams); + User::WaitForRequest(connectionStartStatus); + INFO_PRINTF2(_L("[Loop %d], Connection stopped"), i); + } + timer.Close(); + SetTestStepResult(EPass); + return TestStepResult(); + } + + + + + + + + // Stop Connection //---------------- @@ -1319,3 +1473,30 @@ return EPass; } +// WaitStep +//------------------------------- + +CWaitStep::CWaitStep(CCEsockTestBase*& aEsockTest) +: CTe_EsockStepBase(aEsockTest) + { + SetTestStepName(KWaitStep); + } + +TInt CWaitStep::ConfigureFromIni() + { + if(!GetIntFromConfig(iSection, KTimeoutInMilliSeconds, iTimeOutMs)) + { + INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); + return KErrNotFound; + } + + return KErrNone; + } + +TVerdict CWaitStep::doSingleTestStep() + { + User::After(iTimeOutMs *1000); + return EPass; + } + + diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -1124,6 +1124,18 @@ return error; } +TInt CCEsockTestBase::RemoveConnection(const TDesC& aConnectionName) + { + //check if this connection hasn't been created already + if (iConns.Find(aConnectionName)==NULL) + return KErrNotFound; + + iConns.Remove(aConnectionName); + return KErrNone; + } + + + TInt CCEsockTestBase::OpenConnection(const TRConnectionParams& aParams) { RSocketServ* ss = iSockServs.Find(aParams.iSockServName); @@ -1255,16 +1267,21 @@ TRequestStatus* requestStatus = NULL; if (aParams.iAsynch) { - requestStatus = new TRequestStatus; - if (requestStatus==NULL) - return KErrNoMemory; - - TInt error = iRequestStatuses.Add(requestStatus, aParams.iConnectionName); - if (error!=KErrNone) - { - delete requestStatus; - return error; - } + //The request status may well already be there (created by the previous iteration?) + requestStatus = iRequestStatuses.Find(aParams.iConnectionName); + if (requestStatus == NULL) + { + requestStatus = new TRequestStatus; + if (requestStatus==NULL) + return KErrNoMemory; + + TInt error = iRequestStatuses.Add(requestStatus, aParams.iConnectionName); + if (error!=KErrNone) + { + delete requestStatus; + return error; + } + } } TInt error; diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp --- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -280,6 +280,8 @@ testStep = new CShutdownRSocketStep(iEsockTest); else if(aStepName.CompareF (KStartRConnectionStep) == 0) testStep = new CStartRConnectionStep(iEsockTest); + else if(aStepName.CompareF (KStartStopCrazyLoopRConnectionStep) == 0) + testStep = new CStartStopCrazyLoopRConnectionStep(iEsockTest); else if(aStepName.CompareF (KAwaitRConnectionStartComplete) == 0) testStep = new CAwaitRConnectionStartComplete(iEsockTest); @@ -424,7 +426,9 @@ NEW_ESOCK_TESTSTEP(RegisterProgressNotificationStep) NEW_ESOCK_TESTSTEP(CheckProgressNotificationStep) NEW_ESOCK_TESTSTEP(CheckNegativeProgressNotificationStep) - NEW_ESOCK_TESTSTEP(GetParameters_IntStep) + NEW_ESOCK_TESTSTEP(GetParameters_IntStep) + NEW_ESOCK_TESTSTEP(WaitStep) + return testStep; } diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionDummyNifTestSteps.cpp --- a/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionDummyNifTestSteps.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionDummyNifTestSteps.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -142,7 +142,10 @@ void CProgressWatcherTest1b::DoCancel() { - iConnection.CancelProgressNotification(); + if (iConnection.SubSessionHandle() != 0) + { + iConnection.CancelProgressNotification(); + } } void CProgressWatcherTest1b::RunL() @@ -220,12 +223,11 @@ { INFO_PRINTF2(_L("Closing Connection at Stage %d"), iProgressWatcher->Progress()().iStage); } - - Cancel(); + Cancel(); delete iProgressWatcher; iProgressWatcher = NULL; - iConnection.Close(); + iSocketServ.Close(); } @@ -244,6 +246,7 @@ void CConnectionTest1b::DoCancel() { + iConnection.Close(); StopProgressObservation(); } diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h --- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h Mon Jun 21 17:02:22 2010 +0300 @@ -77,7 +77,7 @@ class CDelayTimer: public CTimer { public: - static CDelayTimer* NewL( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId ); + static CDelayTimer* NewL( const Messages::TNodeId& aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId ); virtual ~CDelayTimer(); void Start( TInt aIntervalInSecs ); @@ -91,16 +91,43 @@ }; private: - CDelayTimer( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId ); + CDelayTimer( const Messages::TNodeId& aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId ); void ConstructL(); protected: // From CTimer (CActive) void RunL(); private: - Messages::RNodeInterface* iSender; + Messages::TNodeId iSender; Messages::TNodeId iRecipient; Messages::TNodeSignal::TMessageId iMessageId; + +public: + //States and Transitions + typedef MeshMachine::TNodeContext TContext; + + template + class TSetTimerMs : public MeshMachine::TStateTransition + { + public: + NETSM_TPL_DECLARE_CTR(TSetTimerMs, NetStateMachine::MStateTransition, TContext) + + TSetTimerMs(TContext& aContext) + :TStateTransition(aContext) + { + } + + virtual void DoL() + { + CDelayTimer* delay = CDelayTimer::NewL(iContext.NodeId(), iContext.NodeId(), Messages::TEBase::TNull::Id()); + delay->Start(IntervalMs); + } + }; + + + DECLARE_SMELEMENT_HEADER( TAwaitingTimerExpired, MeshMachine::TState, NetStateMachine::MState, TContext ) + virtual TBool Accept(); + DECLARE_SMELEMENT_FOOTER( TAwaitingTimerExpired ) }; diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h --- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_metaconnprov.h Mon Jun 21 17:02:22 2010 +0300 @@ -75,13 +75,39 @@ CMCPrPubSubStopTrigger* iPubSubStopTrigger; }; -namespace DummyMCPRStates -{ -typedef MeshMachine::TNodeContext TContext; -DECLARE_SMELEMENT_HEADER( TNoTagOrLoopTag, MeshMachine::TStateFork, NetStateMachine::MStateFork, DummyMCPRStates::TContext ) - virtual TInt TransitionTag(); -DECLARE_SMELEMENT_FOOTER( TNoTagOrLoopTag ) -} // namespace DummyMCPRStates + +class CDummyMCPRControlClientJoinActivity : public MeshMachine::CNodeParallelActivityBase + { +public: + static MeshMachine::CNodeActivityBase* NewL( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode ); + void ReplaceOriginator(Messages::RNodeInterface& aOriginator); +protected: + CDummyMCPRControlClientJoinActivity( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode, TUint aNextActivityCount ) + :MeshMachine::CNodeParallelActivityBase( aActivitySig, aNode, aNextActivityCount ) + {}; + void Cancel(MeshMachine::TNodeContextBase& /*aContext*/) + { + //CDummyMCPRControlClientJoinActivity ignores TCancels, for it's easier than actually handling cancelations. Handling cancelations in join scenarios is not practically + //interesting as joins are normally very swift. This join isn't swift as it's been modified to artificially yield (again easier to yield in Join than elsewhere) + }; + +private: + ~CDummyMCPRControlClientJoinActivity() + { + }; +public: + typedef MeshMachine::TNodeContext TContext; + DECLARE_SMELEMENT_HEADER( TAddControlClient, MeshMachine::TStateTransition, NetStateMachine::MStateTransition, TContext ) + virtual void DoL(); + DECLARE_SMELEMENT_FOOTER( TAddControlClient ) + + DECLARE_SMELEMENT_HEADER( TSendJoinComplete, MeshMachine::TStateTransition, NetStateMachine::MStateTransition, TContext ) + virtual void DoL(); + DECLARE_SMELEMENT_FOOTER( TSendJoinComplete ) + + friend class TAddControlClient; + }; + #endif //SYMBIAN_DUMMYPR_METACONNPROV_H diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp --- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -52,14 +52,13 @@ static const TUint KDefaultMaxPreallocatedActivityCount = 2; static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>); static const TUint KDummyCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize; -static const TUint KDestroyDelay = 3; -static const TUint KMillion = 1000000; +static const TUint KDestroyDelay = 3000; //-================================================ // // States and Transitions // //-================================================ -CDelayTimer* CDelayTimer::NewL( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId ) +CDelayTimer* CDelayTimer::NewL( const Messages::TNodeId& aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId ) { CDelayTimer* timer = new(ELeave) CDelayTimer( aSender, aRecipient, aMessageId ); CleanupStack::PushL( timer ); @@ -73,7 +72,7 @@ Cancel(); } -CDelayTimer::CDelayTimer( Messages::RNodeInterface* aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId ) : +CDelayTimer::CDelayTimer( const Messages::TNodeId& aSender, const Messages::TNodeId& aRecipient, const Messages::TNodeSignal::TMessageId& aMessageId ) : CTimer( EPriorityStandard ), iSender(aSender), iRecipient(aRecipient), @@ -90,13 +89,13 @@ void CDelayTimer::RunL() { CDelayTimer::TDelayMessage msg(iMessageId); - Messages::RClientInterface::OpenPostMessageClose(iSender->RecipientId() , iRecipient, msg ); + Messages::RClientInterface::OpenPostMessageClose(iSender, iRecipient, msg ); delete this; } -void CDelayTimer::Start( TInt aIntervalInSecs ) +void CDelayTimer::Start( TInt aIntervalInMSecs ) { - After( TTimeIntervalMicroSeconds32( aIntervalInSecs * KMillion ) ); + After( TTimeIntervalMicroSeconds32( aIntervalInMSecs * 1000 ) ); } CDelayTimer::TDelayMessage::TDelayMessage() @@ -109,6 +108,12 @@ } +DEFINE_SMELEMENT(CDelayTimer::TAwaitingTimerExpired, NetStateMachine::MState, CDelayTimer::TContext) +TBool CDelayTimer::TAwaitingTimerExpired::Accept() + { + return iContext.iMessage.IsMessage(); + } + namespace DummyCPRStates { DEFINE_SMELEMENT(TSetClientAsIncoming, NetStateMachine::MStateTransition, DummyCPRStates::TContext) @@ -141,7 +146,7 @@ DEFINE_SMELEMENT(TThreeSecDelayAndPostToSelf, NetStateMachine::MStateTransition, DummyCPRStates::TContext) void TThreeSecDelayAndPostToSelf::DoL() { - CDelayTimer* delay = CDelayTimer::NewL(iContext.Node().ControlProvider(), iContext.NodeId(), iContext.iMessage.MessageId() ); + CDelayTimer* delay = CDelayTimer::NewL(iContext.Node().ControlProvider()->RecipientId(), iContext.NodeId(), iContext.iMessage.MessageId() ); delay->Start(KDestroyDelay); } diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/test/providers/dummy/src/dummypr_metaconnprov.cpp --- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_metaconnprov.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_metaconnprov.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -27,6 +27,7 @@ #include #include #include "dummypr_metaconnprov.h" +#include "dummypr_connprov.h" #include "dummypr_mcprpubsubsubscriber.h" #ifdef _DEBUG @@ -42,10 +43,70 @@ +DEFINE_SMELEMENT(CDummyMCPRControlClientJoinActivity::TAddControlClient, NetStateMachine::MStateTransition, TContext) +void CDummyMCPRControlClientJoinActivity::TAddControlClient::DoL() + { + TCFPeer::TJoinRequest& msg = message_cast(iContext.iMessage); + + // Client type could be Messages::TClientType::EWorker (Selection Request) + // or ESock::TCFClientType::ECtrl, possibly others but not ESock::TCFClientType::EData + // which is handled by another activity + ASSERT(msg.iClientType.Type() != (TUint32)TCFClientType::EData); + + iContext.Activity()->ReplaceOriginator( + *iContext.Node().AddClientL(msg.iNodeId, TClientType(TCFClientType::ECtrl))); + } + + +DEFINE_SMELEMENT(CDummyMCPRControlClientJoinActivity::TSendJoinComplete, NetStateMachine::MStateTransition, TContext) +void CDummyMCPRControlClientJoinActivity::TSendJoinComplete::DoL() + { + ASSERT(iContext.iNodeActivity); + + iContext.iNodeActivity->PostToOriginators(TCFPeer::TJoinComplete().CRef()); + } + + +MeshMachine::CNodeActivityBase* CDummyMCPRControlClientJoinActivity::NewL( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode ) + { + TUint c = GetNextActivityCountL(aActivitySig,aNode); + return new(ELeave)CDummyMCPRControlClientJoinActivity(aActivitySig, aNode, c); + } + +void CDummyMCPRControlClientJoinActivity::ReplaceOriginator(RNodeInterface& aOriginator) + { + iOriginators.Remove(0); + TInt err = KErrNone; + TRAP(err, iOriginators.AppendL(XNodePeerId(aOriginator.RecipientId(), &aOriginator))); + ASSERT(err == KErrNone); //This test code is a wee bit lame. If executed in OOM, it may not work. + } + +namespace DummyMCPRControlClientJoinActivity +{ +//DummyMCPRControlClientJoin is a special version of the core MCPR join activity that will artificially yield some time (50ms) to schedule the +//test app. This is done to test RConnection::Stop injections at various RConnection::Start stages. Production MCPRs yield a lot reading database or +//consulting other external entities, so the test MCPR must try to be representative. +DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityClientJoin, DummyMCPRControlClientJoin, TCFServiceProvider::TJoinRequest, CDummyMCPRControlClientJoinActivity::NewL) + FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingControlClientJoin, MeshMachine::TNoTag) + THROUGH_NODEACTIVITY_ENTRY(KNoTag, CDummyMCPRControlClientJoinActivity::TAddControlClient, MeshMachine::TNoTag) + NODEACTIVITY_ENTRY(KNoTag, CDelayTimer::TSetTimerMs<50>, CDelayTimer::TAwaitingTimerExpired, MeshMachine::TNoTag) + THROUGH_NODEACTIVITY_ENTRY(KNoTag, MCprStates::TDecrementBlockingDestroy, MeshMachine::TNoTag) + LAST_NODEACTIVITY_ENTRY(KNoTag, CDummyMCPRControlClientJoinActivity::TSendJoinComplete) +NODEACTIVITY_END() +} + + +namespace DummyMCPRActivities +{ +DECLARE_DEFINE_ACTIVITY_MAP(stateMap) + ACTIVITY_MAP_ENTRY(DummyMCPRControlClientJoinActivity, DummyMCPRControlClientJoin) +ACTIVITY_MAP_END_BASE(MobilityMCprActivities, mobilityMCprActivities) +} + CDummyMetaConnectionProvider* CDummyMetaConnectionProvider::NewL(CMetaConnectionProviderFactoryBase& aFactory, const TProviderInfo& aProviderInfo) { - CDummyMetaConnectionProvider* self = new (ELeave) CDummyMetaConnectionProvider(aFactory,aProviderInfo,MobilityMCprActivities::mobilityMCprActivities::Self()); + CDummyMetaConnectionProvider* self = new (ELeave) CDummyMetaConnectionProvider(aFactory,aProviderInfo,DummyMCPRActivities::stateMap::Self()); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); diff -r 35c06c1d4fa6 -r 07656293a99c serialserver/c32serialserver/LOOPBACK/LOGGER.CPP --- a/serialserver/c32serialserver/LOOPBACK/LOGGER.CPP Wed Jun 09 11:00:38 2010 +0300 +++ b/serialserver/c32serialserver/LOOPBACK/LOGGER.CPP Mon Jun 21 17:02:22 2010 +0300 @@ -74,7 +74,7 @@ { if (FolderExists()) { - iFs.Connect(); + User::LeaveIfError(iFs.Connect()); TInt ret=KErrNone; #if !(defined (_DEBUG)) ret=iFs.Delete(KHayesLogFileName); @@ -260,7 +260,7 @@ */ { TUint n; - iFs.Connect(); + User::LeaveIfError(iFs.Connect()); TInt ret=iFs.Att(KHayesLogFolder,n); iFs.Close(); diff -r 35c06c1d4fa6 -r 07656293a99c serialserver/packetloopbackcsy/inc/Loopback.h --- a/serialserver/packetloopbackcsy/inc/Loopback.h Wed Jun 09 11:00:38 2010 +0300 +++ b/serialserver/packetloopbackcsy/inc/Loopback.h Mon Jun 21 17:02:22 2010 +0300 @@ -40,6 +40,15 @@ _LIT(KSerialDescription, "Packet Loopback CSY"); _LIT(KSerialName, "PKTLOOPBACK"); +_LIT(KPortLoopBackCsyPanic, "PortLoopBack.csy"); + +enum TPortLoopBackCsyPanic + { + /** Input / Output Argument Invalid */ + EPLBArgument + }; + + class CHWPort; diff -r 35c06c1d4fa6 -r 07656293a99c serialserver/packetloopbackcsy/src/loopback.cpp --- a/serialserver/packetloopbackcsy/src/loopback.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/serialserver/packetloopbackcsy/src/loopback.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -489,15 +489,26 @@ LOGTEXT2(_L8("PKTLOOPBACK:BreakCancel is not supported: Unit %d..."), iPortName); } -TInt CHWPort::GetConfig(TDes8& /*aDes*/) const +TInt CHWPort::GetConfig(TDes8& aDes) const /** * This gets the current configuration from the loopback driver. * - * @return KErrNotSupported + * @return KErrNone if the size of the output descriptor is valid */ { - LOGTEXT2(_L8("PKTLOOPBACK:GetConfig is not supported: Unit %d..."), iPortName); + LOGTEXT2(_L8("PKTLOOPBACK:GetConfig: Unit %d..."), iPortName); + + TInt length = aDes.Length(); + __ASSERT_DEBUG( ((length==sizeof(TCommConfigV01)) || + (length==sizeof(TCommConfigV02)) ), + User::Panic(KPortLoopBackCsyPanic, EPLBArgument)); + if (length == sizeof(TCommConfigV01)) + { + aDes.Copy(iConfig); + return KErrNone; + } + return KErrNotSupported; } @@ -506,12 +517,28 @@ * This sets the current configuration for the loopback driver. Note that * no error checking is done when setting the configuration. * - * @return KErrNotSupported + * @return KErrNone if the size of the output descriptor is valid */ { - LOGTEXT2(_L8("PKTLOOPBACK:SetConfig is not supported: Unit %d..."), iPortName); + + LOGTEXT2(_L8("PKTLOOPBACK:SetConfig: Unit %d..."), iPortName); + + TInt length = aDes.Length(); - iConfig.Copy(aDes); + __ASSERT_DEBUG( ((length==sizeof(TCommConfigV01)) || + (length==sizeof(TCommConfigV02))), + User::Panic(KPortLoopBackCsyPanic, EPLBArgument)); + + if (length==sizeof(TCommConfigV01)) + { + iConfig.Copy(aDes); + } + else if (length==sizeof(TCommConfigV02)) + { + TBuf8 buff(aDes); + buff.SetLength(sizeof(TCommConfigV01)); + iConfig.Copy(buff); + } return KErrNone; }