2323 MPMLOGSTRING( |
2323 MPMLOGSTRING( |
2324 "CMPMCommsDatAccess::FindRealIapL: Call ChooseBestIAPL" ) |
2324 "CMPMCommsDatAccess::FindRealIapL: Call ChooseBestIAPL" ) |
2325 |
2325 |
2326 TMpmConnPref tempMpmConnPref; |
2326 TMpmConnPref tempMpmConnPref; |
2327 tempMpmConnPref.SetSnapId( snap ); |
2327 tempMpmConnPref.SetSnapId( snap ); |
2328 aSession.IapSelectionL()->ChooseBestIAPL( tempMpmConnPref, aAvailableIAPList ); |
2328 |
|
2329 // Ensure that there will be no infinite loops by dropping |
|
2330 // this virtual iap out from the list of available iaps. |
|
2331 // E.g. next layer SNAP could be the same as current SNAP. |
|
2332 RAvailableIAPList tempList; |
|
2333 CleanupClosePushL( tempList ); |
|
2334 |
|
2335 for( TInt i=0; i < aAvailableIAPList.Count(); i++ ) |
|
2336 { |
|
2337 // drop this virtual iap out from the list of |
|
2338 // available iaps to prevent from infinitely looping |
|
2339 // |
|
2340 if ( aAvailableIAPList[i] != aVirtualIapId ) |
|
2341 { |
|
2342 tempList.Append( aAvailableIAPList[i] ); |
|
2343 } |
|
2344 } |
|
2345 aSession.IapSelectionL()->ChooseBestIAPL( tempMpmConnPref, tempList ); |
|
2346 CleanupStack::PopAndDestroy( &tempList ); |
|
2347 |
2329 aRealIapId = tempMpmConnPref.IapId(); |
2348 aRealIapId = tempMpmConnPref.IapId(); |
2330 } |
2349 } |
2331 else if ( virtualNext->iNextLayerIAP != 0 ) |
2350 else if ( virtualNext->iNextLayerIAP != 0 ) |
2332 { |
2351 { |
2333 // IAP |
2352 // IAP |
2342 "CMPMCommsDatAccess::FindRealIapL: Virtual IAP: %i", |
2361 "CMPMCommsDatAccess::FindRealIapL: Virtual IAP: %i", |
2343 iap2->RecordId() ) |
2362 iap2->RecordId() ) |
2344 MPMLOGSTRING( |
2363 MPMLOGSTRING( |
2345 "CMPMCommsDatAccess::FindRealIapL: Call FindRealIapL" ) |
2364 "CMPMCommsDatAccess::FindRealIapL: Call FindRealIapL" ) |
2346 |
2365 |
2347 FindRealIapL( iap2->RecordId(), |
2366 if ( aVirtualIapId != virtualNext->iNextLayerIAP ) |
2348 aRealIapId, |
2367 { |
2349 aAvailableIAPList, |
2368 FindRealIapL( iap2->RecordId(), |
2350 aSession ); |
2369 aRealIapId, |
|
2370 aAvailableIAPList, |
|
2371 aSession ); |
|
2372 } |
|
2373 else |
|
2374 { |
|
2375 aRealIapId = 0; |
|
2376 MPMLOGSTRING( "CMPMCommsDatAccess::FindRealIapL: Virtual iap points to itself" ) |
|
2377 } |
2351 } |
2378 } |
2352 else |
2379 else |
2353 { |
2380 { |
2354 aRealIapId = iap2->RecordId(); |
2381 aRealIapId = iap2->RecordId(); |
2355 |
2382 |
2670 // ----------------------------------------------------------------------------- |
2697 // ----------------------------------------------------------------------------- |
2671 // CMPMCommsDatAccess::AreActiveIapsInSameSnapL |
2698 // CMPMCommsDatAccess::AreActiveIapsInSameSnapL |
2672 // ----------------------------------------------------------------------------- |
2699 // ----------------------------------------------------------------------------- |
2673 // |
2700 // |
2674 TBool CMPMCommsDatAccess::AreActiveIapsInSameSnapL ( RArray<TActiveBMConn>& aActiveBMConns, |
2701 TBool CMPMCommsDatAccess::AreActiveIapsInSameSnapL ( RArray<TActiveBMConn>& aActiveBMConns, |
2675 TUint32& aSnapId ) |
2702 TUint32& aSnapId, |
|
2703 CMPMServer& aServer ) |
2676 { |
2704 { |
2677 MPMLOGSTRING( "CMPMCommsDatAccess::AreActiveIapsInSameSnapL" ) |
2705 MPMLOGSTRING( "CMPMCommsDatAccess::AreActiveIapsInSameSnapL" ) |
2678 TBool same = ETrue; |
2706 TBool same = ETrue; |
2679 TUint32 snapId = 0; |
2707 TUint32 snapId = 0; |
2680 TUint32 prevSnapId = 0; |
2708 TUint32 prevSnapId = 0; |
2681 |
2709 |
2682 // Go through all active connections |
2710 // Go through all active connections |
2683 for (TInt index = 0; index < aActiveBMConns.Count(); index++ ) |
2711 for (TInt index = 0; index < aActiveBMConns.Count(); index++ ) |
2684 { |
2712 { |
|
2713 CMPMServerSession* serverSession = aServer.GetServerSession( |
|
2714 aActiveBMConns[index].iConnInfo.iConnId ); |
|
2715 |
2685 // Do check only for active connections |
2716 // Do check only for active connections |
2686 if ( aActiveBMConns[index].iConnInfo.iState != EStarted ) |
2717 if ( aActiveBMConns[index].iConnInfo.iState != EStarted || |
|
2718 !serverSession->ChooseBestIapCalled()) |
2687 { |
2719 { |
2688 continue; |
2720 continue; |
2689 } |
2721 } |
2690 |
2722 |
2691 // Iap id must be nonzero |
2723 // Iap id must be nonzero |
2692 if ( aActiveBMConns[index].iConnInfo.iIapId ) |
2724 if ( aActiveBMConns[index].iConnInfo.iIapId ) |
2693 { |
2725 { |
2694 prevSnapId = snapId; |
2726 prevSnapId = snapId; |
2695 // Get destination id for the iap |
2727 // Get destination id for the iap |
2696 snapId = GetSnapIdL( aActiveBMConns[index].iConnInfo.iIapId ); |
2728 snapId = aActiveBMConns[index].iConnInfo.iSnap; |
2697 |
2729 |
2698 // Check if previous iap's destination is different |
2730 // Check if previous iap's destination is different |
2699 if ( ( ( prevSnapId != snapId ) && prevSnapId && snapId ) || |
2731 if ( ( ( prevSnapId != snapId ) && prevSnapId && snapId ) || |
2700 !snapId ) |
2732 !snapId ) |
2701 { |
2733 { |
2702 // Set return value to false and leave loop |
2734 // Set return value to false and leave loop |
2772 iapIds.Remove( k ); |
2804 iapIds.Remove( k ); |
2773 } |
2805 } |
2774 } |
2806 } |
2775 |
2807 |
2776 // Determine the actual priorities for IAPs |
2808 // Determine the actual priorities for IAPs |
2777 DeterminePrioritiesL( iapIds, activeIaps, aSession ); |
2809 if( iapIds.Count() > 1 ) |
|
2810 { |
|
2811 DeterminePrioritiesL( iapIds, activeIaps, aSession ); |
|
2812 } |
2778 |
2813 |
2779 // Check if a matching available IAP is found. |
2814 // Check if a matching available IAP is found. |
2780 if( iapIds.Count() ) |
2815 if( iapIds.Count() ) |
2781 { |
2816 { |
2782 // Go through all iaps |
2817 // Go through all iaps |