301 NODEACTIVITY_ENTRY(KNoTag, ConnStates::TProcessStateChange, MeshMachine::TAwaitingMessageState<TCFMessage::TStateChange>, MeshMachine::TNoTag) |
301 NODEACTIVITY_ENTRY(KNoTag, ConnStates::TProcessStateChange, MeshMachine::TAwaitingMessageState<TCFMessage::TStateChange>, MeshMachine::TNoTag) |
302 NODEACTIVITY_END() |
302 NODEACTIVITY_END() |
303 } |
303 } |
304 |
304 |
305 |
305 |
306 |
|
307 namespace ConnectionGoingDownActivity |
306 namespace ConnectionGoingDownActivity |
308 { |
307 { |
309 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityGoneDown, ConnectionGoingDown, TCFControlClient::TGoneDown, PRActivities::CGoneDownActivity::NewL) |
308 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityGoneDown, ConnectionGoingDown, TCFControlClient::TGoneDown, PRActivities::CGoneDownActivity::NewL) |
310 FIRST_NODEACTIVITY_ENTRY(ConnStates::TAwaitingGoneDown, MeshMachine::TNoTag) |
309 FIRST_NODEACTIVITY_ENTRY(ConnStates::TAwaitingGoneDown, MeshMachine::TNoTag) |
311 THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnectionGoingDownActivity::TStoreGoneDownError, MeshMachine::TNoTag) |
310 THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnectionGoingDownActivity::TStoreGoneDownError, MeshMachine::TNoTag) |
312 THROUGH_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TCancelAndCloseZone0ClientExtIfaces, MeshMachine::TNoTag) |
311 THROUGH_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TCancelAndCloseZone0ClientExtIfaces, MeshMachine::TNoTag) |
313 THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TCancelAllLegacyRMessage2Activities, ConnStates::TNoTagBlockedByLegacyRMessage2Activities) |
312 THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TCancelAllLegacyRMessage2Activities, ConnStates::TNoTagBlockedByLegacyRMessage2Activities) |
|
313 THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TGenerateConnectionDownProgress, MeshMachine::TNoTag) |
314 NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendClientLeavingRequestToServiceProviders, MeshMachine::TAwaitingLeaveComplete, MeshMachine::TNoTag) |
314 NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendClientLeavingRequestToServiceProviders, MeshMachine::TAwaitingLeaveComplete, MeshMachine::TNoTag) |
315 NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSetIdleIfNoServiceProviders, MeshMachine::TAwaitingLeaveComplete, ConnectionCleanupActivities::TNoTagOrNoTagBackwards) |
315 NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSetIdleIfNoServiceProviders, MeshMachine::TAwaitingLeaveComplete, ConnectionCleanupActivities::TNoTagOrNoTagBackwards) |
316 LAST_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TGenerateConnectionDownProgress) |
316 LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing) |
317 NODEACTIVITY_END() |
317 NODEACTIVITY_END() |
318 } |
318 } |
319 |
319 |
320 // |
320 // |
321 //Activities serving framework requests for legacy actions |
321 //Activities serving framework requests for legacy actions |
400 */ |
400 */ |
401 CConnection::CConnection(CSockSession* aSession, CPlayer* aPlayer, TUid aTierId, const Den::TSubSessionUniqueId aSubSessionUniqueId) |
401 CConnection::CConnection(CSockSession* aSession, CPlayer* aPlayer, TUid aTierId, const Den::TSubSessionUniqueId aSubSessionUniqueId) |
402 : CMMSockSubSession(ConnectionActivities::connectionActivities::Self(), aSession, aPlayer, aSubSessionUniqueId), |
402 : CMMSockSubSession(ConnectionActivities::connectionActivities::Self(), aSession, aPlayer, aSubSessionUniqueId), |
403 ASubSessionPlatsecApiExt(UniqueId()), |
403 ASubSessionPlatsecApiExt(UniqueId()), |
404 TIfStaticFetcherNearestInHierarchy(this), |
404 TIfStaticFetcherNearestInHierarchy(this), |
|
405 iLastProgress(KConnectionUninitialised, KErrNone), |
|
406 iLastProgressError(KConnectionUninitialised, KErrNone), |
405 iTierId(aTierId), |
407 iTierId(aTierId), |
406 iLegacyConnection(*this) |
408 iLegacyConnection(*this) |
407 { |
409 { |
408 LOG_NODE_CREATE1(KESockConnectionTag, CConnection, ", session %08x", aSession); |
410 LOG_NODE_CREATE1(KESockConnectionTag, CConnection, ", session %08x", aSession); |
409 } |
411 } |
514 void CConnection::CloneL(const CConnection& aExistingConnection) |
516 void CConnection::CloneL(const CConnection& aExistingConnection) |
515 /** |
517 /** |
516 Main body of CConnection::NewL(CSockSession* aSession, const CConnection& aExistingConnection) |
518 Main body of CConnection::NewL(CSockSession* aSession, const CConnection& aExistingConnection) |
517 */ |
519 */ |
518 { |
520 { |
|
521 // will need to be brought over |
|
522 iLastProgress = aExistingConnection.iLastProgress; |
|
523 iLastProgressError = aExistingConnection.iLastProgressError; |
|
524 iProgressQueue = aExistingConnection.iProgressQueue; |
|
525 |
|
526 /** |
|
527 The first commented in section of code here is incorrect. It only clones one of the service providers and not them |
|
528 all. This means that certain calls, GetIntSetting being one, does not work on cloned connections. Unfortunately, |
|
529 some code now relies on this being broken (browser). This code needs to be fixed before the first section of code |
|
530 is removed and the proper code reinstated. |
|
531 */ |
|
532 #if 1 // BAD CODE |
519 RNodeInterface* sp = aExistingConnection.ServiceProvider(); |
533 RNodeInterface* sp = aExistingConnection.ServiceProvider(); |
520 if (sp) |
534 if (sp) |
521 { |
535 { |
522 AddClientL(sp->RecipientId(), TClientType(TCFClientType::EServProvider, TCFClientType::EActive)); |
536 AddClientL(sp->RecipientId(), TClientType(TCFClientType::EServProvider, TCFClientType::EActive)); |
523 |
537 |
527 else |
541 else |
528 { |
542 { |
529 LOG( ESockLog::Printf(KESockConnectionTag, _L8("CConnection %08x CloneL KErrNotReady"), this) ); |
543 LOG( ESockLog::Printf(KESockConnectionTag, _L8("CConnection %08x CloneL KErrNotReady"), this) ); |
530 User::Leave(KErrNotReady); |
544 User::Leave(KErrNotReady); |
531 } |
545 } |
|
546 |
|
547 #else // PROPER CODE |
|
548 /* |
|
549 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 |
|
550 sending the messages to ourselves, otherwise the mesh machine will panic. |
|
551 */ |
|
552 TInt numSP = 0; |
|
553 TClientIter<TDefaultClientMatchPolicy> iter = aExistingConnection.GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider), |
|
554 Messages::TClientType(TCFClientType::EServProvider, Messages::TClientType::ELeaving)); |
|
555 |
|
556 /** |
|
557 Add clients to client list. If this fails at any point, remove anything we've added. |
|
558 Makes assumption that we are the only thing adding service providers. |
|
559 */ |
|
560 RNodeInterface* sp = iter++; |
|
561 while (sp) |
|
562 { |
|
563 TRAPD(err, AddClientL(sp->RecipientId(), sp->ClientType())); |
|
564 if (err != KErrNone) |
|
565 { |
|
566 sp = GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider)); |
|
567 while (sp) |
|
568 { |
|
569 RemoveClient(sp->RecipientId()); |
|
570 sp = GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider)); |
|
571 } |
|
572 User::Leave(err); |
|
573 } |
|
574 |
|
575 sp = iter++; |
|
576 numSP++; |
|
577 } |
|
578 |
|
579 /** |
|
580 If we managed to add anything, post messages to them so that we get added as control clients |
|
581 */ |
|
582 if (numSP == 0) |
|
583 { |
|
584 LOG( ESockLog::Printf(KESockConnectionTag, _L8("CConnection %08x CloneL KErrNotReady"), this) ); |
|
585 User::Leave(KErrNotReady); |
|
586 } |
|
587 else |
|
588 { |
|
589 TClientIter<TDefaultClientMatchPolicy> iter = GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider)); |
|
590 sp = iter++; |
|
591 while (sp) |
|
592 { |
|
593 // TODO IK: This is the wrong message to be using here, should use JoinRequest/Complete handshake |
|
594 sp->PostMessage(Id(), TCFFactory::TPeerFoundOrCreated(Id(), 0).CRef()); |
|
595 sp = iter++; |
|
596 } |
|
597 } |
|
598 #endif |
532 } |
599 } |
533 |
600 |
534 |
601 |
535 RNodeInterface* CConnection::DefaultSubConnectionServiceProvider() |
602 RNodeInterface* CConnection::DefaultSubConnectionServiceProvider() |
536 { |
603 { |
789 } |
856 } |
790 |
857 |
791 |
858 |
792 void CConnection::ProgressL() |
859 void CConnection::ProgressL() |
793 { |
860 { |
794 if (iLastProgress.iStage != KConnectionUp && iLastProgress.iStage != KConnectionDown) |
861 if (iLastProgress.iStage != KConnectionUp |
|
862 && iLastProgress.iStage != KConnectionDown |
|
863 && iLastProgress.iStage != KConnectionUninitialised) |
795 { |
864 { |
796 RNodeInterface* sp = ServiceProvider(); |
865 RNodeInterface* sp = ServiceProvider(); |
797 User::LeaveIfError(sp? KErrNone : KErrNotReady); |
866 User::LeaveIfError(sp? KErrNone : KErrNotReady); |
798 |
867 |
799 TCprRetrieveProgress msg(SafeMessage(), iLastProgress); |
868 TCprRetrieveProgress msg(SafeMessage(), iLastProgress); |
810 SetReturn(KErrNone); |
879 SetReturn(KErrNone); |
811 } |
880 } |
812 |
881 |
813 void CConnection::LastProgressErrorL() |
882 void CConnection::LastProgressErrorL() |
814 { |
883 { |
815 if (iLastProgress.iStage != KConnectionUp && iLastProgress.iStage != KConnectionDown) |
884 if (iLastProgress.iStage != KConnectionUp |
|
885 && iLastProgress.iStage != KConnectionDown |
|
886 && iLastProgress.iStage != KConnectionUninitialised) |
816 { |
887 { |
817 RNodeInterface* sp = ServiceProvider(); |
888 RNodeInterface* sp = ServiceProvider(); |
818 User::LeaveIfError(sp? KErrNone : KErrNotReady); |
889 User::LeaveIfError(sp? KErrNone : KErrNotReady); |
819 |
890 |
820 TCprRetrieveLastProgressError msg(SafeMessage(), iLastProgressError); |
891 TCprRetrieveLastProgressError msg(SafeMessage(), iLastProgressError); |
995 NODEACTIVITY_ENTRY(KNoTag, TStartLinkNotification, TAwaitingLinkNotification, CoreStates::TCancelOrErrorOrTag<KNoTag>) |
1066 NODEACTIVITY_ENTRY(KNoTag, TStartLinkNotification, TAwaitingLinkNotification, CoreStates::TCancelOrErrorOrTag<KNoTag>) |
996 |
1067 |
997 // Enqueue the notification and wait for the next one - we loop here forever |
1068 // Enqueue the notification and wait for the next one - we loop here forever |
998 NODEACTIVITY_ENTRY(KNoTag, TEnqueueNotification, TAwaitingLinkNotification, CoreStates::TCancelOrErrorOrTag<KNoTag|EBackward>) |
1069 NODEACTIVITY_ENTRY(KNoTag, TEnqueueNotification, TAwaitingLinkNotification, CoreStates::TCancelOrErrorOrTag<KNoTag|EBackward>) |
999 |
1070 |
1000 THROUGH_TRIPLE_ENTRY(KErrorTag, MeshMachine::TStoreError, MeshMachine::TTag<KCancelTag>) |
|
1001 // If we received a TCancel from CConnection, reply with TError to complete shutdown handshake. |
1071 // If we received a TCancel from CConnection, reply with TError to complete shutdown handshake. |
1002 THROUGH_NODEACTIVITY_ENTRY(KCancelTag, TSendErrorToConnection, MeshMachine::TTag<KCancelTag>) |
1072 NODEACTIVITY_ENTRY(KCancelTag, TCancelLinkNotification, TAwaitingLinkNotificationError, MeshMachine::TTag<KErrorTag>) |
1003 NODEACTIVITY_ENTRY(KCancelTag, TCancelLinkNotification, TAwaitingLinkNotificationError, MeshMachine::TNoTag) |
1073 THROUGH_TRIPLE_ENTRY(KErrorTag, TSendErrorToConnection, MeshMachine::TNoTag) |
1004 LAST_NODEACTIVITY_ENTRY(KNoTag, TLeaveTierManager) // no other sessions with tier so can safely fire & forget this |
1074 LAST_NODEACTIVITY_ENTRY(KNoTag, TLeaveTierManager) // no other sessions with tier so can safely fire & forget this |
1005 NODEACTIVITY_END() |
1075 NODEACTIVITY_END() |
1006 } |
1076 } |
1007 |
1077 |
1008 namespace AllInterfaceNotificationActivities |
1078 namespace AllInterfaceNotificationActivities |