1602 // |
1602 // |
1603 // Aggregate class containing common functionality for |
1603 // Aggregate class containing common functionality for |
1604 // CommsBinderActivity and CCommsBinderCombiningActivity. |
1604 // CommsBinderActivity and CCommsBinderCombiningActivity. |
1605 // |
1605 // |
1606 //-========================================================= |
1606 //-========================================================= |
1607 |
1607 // When I node need to create the data client, this mutex block if the dataclient is leaving. |
|
1608 // A scenario can arise when a connection is being started, stopped and started again in succession. |
|
1609 // the stop might interfere with the second start and ccause the second start to fail. |
|
1610 // this mutex will ensure that the leaving DC is completely destroyed, and then the second start is continued |
|
1611 // - when any of the data clients is being destroyed |
|
1612 // - when a non-leaving data client is present or the activity is already running |
|
1613 // |
1608 EXPORT_C TBool CCommsBinderActivity::TDataClientMutex::IsBlocked(MeshMachine::TNodeContextBase& aContext) |
1614 EXPORT_C TBool CCommsBinderActivity::TDataClientMutex::IsBlocked(MeshMachine::TNodeContextBase& aContext) |
1609 { |
1615 { |
1610 TInt c = aContext.Node().CountActivities(aContext.iNodeActivity->ActivitySigId()); |
1616 TInt c = aContext.Node().CountActivities(aContext.iNodeActivity->ActivitySigId()); |
1611 __ASSERT_DEBUG(c>0, User::Panic(KSpecAssert_ESockCrStaCPRAC, 17)); //Diagnostic |
1617 __ASSERT_DEBUG(c>0, User::Panic(KSpecAssert_ESockCrStaCPRAC, 17)); //Diagnostic |
1612 if (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext)) |
1618 TInt numOfLeavingDataClients = aContext.Node().CountClients<TDefaultClientMatchPolicy>( |
|
1619 /*include*/TClientType(TCFClientType::EData, TCFClientType::ELeaving)); |
|
1620 if (numOfLeavingDataClients == 0 && (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext))) |
1613 { |
1621 { |
1614 return EFalse; |
1622 return EFalse; |
1615 } |
1623 } |
1616 return ETrue; |
1624 return ETrue; |
1617 } |
1625 } |
1618 |
1626 |
1619 EXPORT_C TBool CCommsBinderActivity::TDefaultDataClientMutex::IsBlocked(MeshMachine::TNodeContextBase& aContext) |
1627 EXPORT_C TBool CCommsBinderActivity::TDefaultDataClientMutex::IsBlocked(MeshMachine::TNodeContextBase& aContext) |
1620 { |
1628 { |
1621 TInt c = aContext.Node().CountActivities(aContext.iNodeActivity->ActivitySigId()); |
1629 TInt c = aContext.Node().CountActivities(aContext.iNodeActivity->ActivitySigId()); |
1622 __ASSERT_DEBUG(c>0, User::Panic(KSpecAssert_ESockCrStaCPRAC, 18)); //Diagnostic |
1630 __ASSERT_DEBUG(c>0, User::Panic(KSpecAssert_ESockCrStaCPRAC, 18)); //Diagnostic |
1623 if (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext, TCFClientType::EDefault)) |
1631 TInt numOfLeavingDataClients = aContext.Node().CountClients<TDefaultClientMatchPolicy>( |
|
1632 /*include*/TClientType(TCFClientType::EData, TCFClientType::ELeaving)); |
|
1633 if (numOfLeavingDataClients == 0 && (c == 1 || CCommsBinderActivity::IsDataClientPresent(aContext, TCFClientType::EDefault))) |
1624 { |
1634 { |
1625 return EFalse; |
1635 return EFalse; |
1626 } |
1636 } |
1627 return ETrue; |
1637 return ETrue; |
1628 } |
1638 } |
1698 address_cast<Messages::TNodeId>(FirstOriginator().RecipientId()), |
1708 address_cast<Messages::TNodeId>(FirstOriginator().RecipientId()), |
1699 TCFServiceProvider::TCommsBinderResponse(iPendingBinder->RecipientId()).CRef()); |
1709 TCFServiceProvider::TCommsBinderResponse(iPendingBinder->RecipientId()).CRef()); |
1700 |
1710 |
1701 iPendingBinder->SetFlags(TCFClientType::EActivating); |
1711 iPendingBinder->SetFlags(TCFClientType::EActivating); |
1702 } |
1712 } |
|
1713 |
1703 |
1714 |
1704 EXPORT_C void CCommsBinderActivity::Cancel(TNodeContextBase& aContext) |
1715 EXPORT_C void CCommsBinderActivity::Cancel(TNodeContextBase& aContext) |
1705 { |
1716 { |
1706 if (iPendingBinder) |
1717 if (iPendingBinder) |
1707 { |
1718 { |